cjramki / svg2vml

Automatically exported from code.google.com/p/svg2vml
0 stars 0 forks source link

IE 7: this.points is undefined if you want to replace polyline points in a vml element #4

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. launch ie
2. create a polyline with svg2vml, set the points, this will work
3. use the polyline object reference to set points again with 
myPoly.setAttribute('points', pointStringValue) - this works in other 
browsers, but not in IE. instead of that a exception is thrown and 
further investigation shows that "this.points" is undefined in svg2vml 
here:

        } else if ( key == "points" ) {
            this.points = value;
            return;
        }

What is the expected output? What do you see instead?
expected: polyline is replaced with new points. you see instead (in IE): 
exception -> this.points is undefined.

What version of the product are you using? On what operating system?
IE 7 - windows

Please provide any additional information below.

currently an easy workaround is to do a try catch around this code 
snippet, but this will not solve the problem that you cannot replace 
points in a polyline. i will investigate further how to fix this problem 
with ie..

used the svg2vml library checked out today (20th May 2008)

Original issue reported on code.google.com by buf...@gmail.com on 20 May 2008 at 10:52

GoogleCodeExporter commented 8 years ago
this problem is not new as I found out:
http://newsgroups.derkeiler.com/Archive/Comp/comp.lang.javascript/2008-02/msg010
83.html

Original comment by buf...@gmail.com on 20 May 2008 at 10:57

GoogleCodeExporter commented 8 years ago
I tried whats described in the article, and it works. I did it like this, where 
myPoly is a dom object reference to the specific polyline :

        var myPolyParent = myPoly.parentNode;
        var myPolyCopy = myPoly.cloneNode(true); // deep clone
        myPolyParent.removeChild(myPoly); 
        myPolyCopy.setAttribute('points', str); 
        myPolyParent.appendChild(myPolyCopy);

unfortunately the "attributes" like fill or not fill, strokeWidth, strokeColor 
etc. 
seem to go lost, although doing a deep clone of the node :( 

Original comment by buf...@gmail.com on 21 May 2008 at 10:32

GoogleCodeExporter commented 8 years ago

Original comment by n...@sgtwilko.f9.co.uk on 10 Feb 2010 at 1:49