mustang2247 / svgweb

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

setAttribute gives error for undefined or null attribute value (Flash renderer) #428

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. try to use setAttribute with a null value (ex:
point.setAttribute('fill', null);)

What is the expected output? What do you see instead?
setAttribute should treat a null or undefined value as an empty string

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

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

Original issue reported on code.google.com by jonathan...@gmail.com on 25 Nov 2009 at 1:28

Attachments:

GoogleCodeExporter commented 8 years ago
Here is a simple patch to correct this behaviour

Original comment by jonathan...@gmail.com on 26 Nov 2009 at 10:49

Attachments:

GoogleCodeExporter commented 8 years ago
I have verified that this simple patch would replicate the behavior of firefox. 
I
think it should be applied.

Original comment by grick23@gmail.com on 28 Nov 2009 at 10:26

GoogleCodeExporter commented 8 years ago

Original comment by bradneub...@gmail.com on 29 Nov 2009 at 6:42

GoogleCodeExporter commented 8 years ago
Nice patch; one small change to make it match how we format our JavaScript (we 
always
add {} even for one line if statements to protect against copy/paste bugs from
patches); I would also use === instead of == when dealing with null:

if (attrValue === null || typeof attrValue == 'undefined') {
   attrValue = '';
}

We really should make a JS and AS style guide to help contributors...

Original comment by bradneub...@gmail.com on 29 Nov 2009 at 6:44

GoogleCodeExporter commented 8 years ago

Original comment by bradneub...@gmail.com on 29 Nov 2009 at 6:47

GoogleCodeExporter commented 8 years ago

Original comment by bradneub...@gmail.com on 29 Nov 2009 at 6:48

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r1012.

Original comment by bradneub...@gmail.com on 29 Nov 2009 at 6:49

GoogleCodeExporter commented 8 years ago
Patch applied; thanks!

Original comment by bradneub...@gmail.com on 29 Nov 2009 at 6:49