lewisje / svgweb

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

document.getElementById via Flash fails when style="text-align:start" is present #485

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. In embedded SVG, add style="text-align:start" to an SVG element
2. Using Javascript, call document.getElementById(id) to try to look up the
element
3. Load in IE with the flash renderer

This is easiest to try with svgweb's included helloworld.html.
 - Add style="text-align:start" as an attribute of <circle id="myCircle" .../>
 - View the page in IE/Flash, and try the change colors action

What is the expected output? What do you see instead?

I expect the getElementById call to succeed, whether or not the style
attribute is on the object being referenced. In the simple helloworld
example, I instead get two Javascript errors (the second after reload):

Error: Could not get the textAlign property. Invalid argument.

Error: '_fakeNode.style._changeListener' is null or not an object

However in my "real" file as opposed to this minimal example, I only get
the second error, and had to remove extraneous styles one by one to see
which caused the error. None of these other styles caused any problem for
document.getElementById(id):

style="font-size:11px;font-style:normal;font-variant:normal;font-weight:normal;f
ont-stretch:normal;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:no
ne;stroke:#3305ee;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;strok
e-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;font-family:Arial;-inkscap
e-font-specification:Arial"

What version of the product are you using? On what operating system,
browser, and version of Flash?

dracolisk, Windows 7, IE 8, Flash 10,0,42,34

Please provide any additional information below. Reduced test cases are
always appreciated!

The easy fix clearly is to not include these unneeded style attributes,
however the files I am working with are exported from Inkscape, and at
times these extra attributes accumulate and require manual edits to remove.
It seems they should not cause Javascript errors if not technically invalid.

Original issue reported on code.google.com by Bjorn...@gmail.com on 4 May 2010 at 4:38

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by bradneub...@gmail.com on 4 May 2010 at 5:30

GoogleCodeExporter commented 8 years ago
Fixed in r1133.
The fix absorbs the exception. Not sure what the problem is with IE, but it may 
be
that certain styles are not acceptable on the fake htc proxy nodes we create 
for IE.
I tried setting the htcStyle[styleName] to null and "" before setting it, but 
no luck. 

Luckily it is only textAlign style and not something more common like 
textAnchor. SVG
Web does not currently support textAlign anyway. There may be other problems 
with
textAlign in the future but I'd rather cross that bridge when we get to it. 
Marking
fixed.

Original comment by grick23@gmail.com on 5 May 2010 at 2:04