[Webkit-unassigned] [Bug 15276] setAttribute fails to respect SVG attribute case

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 26 10:57:17 PDT 2007


http://bugs.webkit.org/show_bug.cgi?id=15276


eric at webkit.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Linear gradient bug in SVG  |setAttribute fails to
                   |                            |respect SVG attribute case




------- Comment #13 from eric at webkit.org  2007-09-26 10:57 PDT -------
Ok, I've learned a few things.

By adding this to your test:

var svgNs = "http://www.w3.org/2000/svg"
var gradient = document.createElementNS(svgNs, "linearGradient");
var gradientClass = gradient.__proto__;
gradientClass.oldSetAttribute = gradientClass.setAttribute;
gradientClass.oldSetAttributeNS = gradientClass.setAttributeNS;

gradientClass.setAttribute = function(a, b, c) { alert("setAttribute: " + a + "
" + b); this.oldSetAttributeNS(null, a, b) }
gradientClass.setAttributeNS = function(a, b, c) { alert("setAttributeNS: " + a
+ " " + b + " " + c); this.oldSetAttributeNS(null, b, c) }


I have determined two things:

1.  Your code is still setting a bunch of attributes with the SVG namespace. 
As you've noted above, this is wrong.  We seem to be ignoring the namespace in
many parts of our code (which is allowing your setNamespaceNS calls to work,
which they shouldn't).

2.  We have a check:
static inline bool shouldIgnoreAttributeCase(const Element* e)
{
    return e && e->document()->isHTMLDocument() && e->isHTMLElement();
}
before every place that we ignore attribute case.  This code is designed to
prevent exactly the problem you're seeing, but something's (obviously) not
working.

As you notice in my code above, I'm overriding setAttribute and calling
setAttributeNS (with a null namespace) instead.  That fixes the problem.  So a
quick fix for dojo is to always use setAttributeNS instead.  Be careful to
always use a null namespace instead of the svg namespace, as we'll eventually
fix our bug and start ignoring attributes in the SVG namespace.

Still investigating.


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list