
svgweb - issue #428
setAttribute gives error for undefined or null attribute value (Flash renderer)
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!
- test2.html 1.12KB
Comment #1
Posted on Nov 26, 2009 by Quick BearHere is a simple patch to correct this behaviour
Comment #2
Posted on Nov 28, 2009 by Grumpy DogI have verified that this simple patch would replicate the behavior of firefox. I think it should be applied.
Comment #3
Posted on Nov 29, 2009 by Massive Bird(No comment was entered for this change.)
Comment #4
Posted on Nov 29, 2009 by Massive BirdNice 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...
Comment #5
Posted on Nov 29, 2009 by Massive Bird(No comment was entered for this change.)
Comment #6
Posted on Nov 29, 2009 by Massive Bird(No comment was entered for this change.)
Comment #7
Posted on Nov 29, 2009 by Massive BirdThis issue was closed by revision r1012.
Comment #8
Posted on Nov 29, 2009 by Massive BirdPatch applied; thanks!
Status: Fixed
Labels:
Type-Defect
Priority-Medium
Patch