WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
7492
CSS attribute selectors fail when the setAttribute() function is used to create an attribute and the attribute's name is not "class" or "id"
https://bugs.webkit.org/show_bug.cgi?id=7492
Summary
CSS attribute selectors fail when the setAttribute() function is used to crea...
Chris Bentley
Reported
2006-02-27 05:04:12 PST
Summary: When an element's attribute is created using the setAttribute() method then only the attributes named "class" and "id" affect the rendering by associated CSS Attribute Selector rules. The CSS ignores any other attribute name. Steps to reproduce: The page at
http://code.clientside.net.au/safari/setAttribute.html
demonstrates the issue. Expected behaviour: I expect Safari to style an element using a CSS Attribute Selector when the attribute has been created using setAttribute() . eg. setAttribute('title','This is a tooltip') // el[title] Actual Behaviour: Only the "class" and "id" attributes affect the CSS rendering of an element when the attribute is created using the setAttribute() method in Safari. Workaround: None found. Isolation: Fails on Safari (except with class and id attributes). Firefox 1.5 and Opera 8.5 (Mac) behave as expected.
Attachments
Test case
(1.33 KB, text/html)
2006-02-27 05:34 PST
,
David Kilzer (:ddkilzer)
no flags
Details
Proposed patch
(3.66 KB, patch)
2006-05-08 06:50 PDT
,
Rob Buis
mjs
: review-
Details
Formatted Diff
Diff
test case that I suspect won't work w/ this patch
(523 bytes, text/html)
2006-05-08 21:31 PDT
,
Maciej Stachowiak
no flags
Details
New approach
(3.92 KB, patch)
2006-05-10 00:57 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Now includes a testcase!
(6.04 KB, patch)
2006-05-10 12:20 PDT
,
Rob Buis
mjs
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
David Kilzer (:ddkilzer)
Comment 1
2006-02-27 05:34:16 PST
Created
attachment 6759
[details]
Test case Test case from URL provided.
David Kilzer (:ddkilzer)
Comment 2
2006-02-27 05:36:44 PST
Adding HasReduction keyword. This is broken in Safari 2.0.3 (417.8) in 10.4.5 as well as the WebKit nightlies (locally built
r12990
), and thus is not a regression.
Rob Buis
Comment 3
2006-05-08 06:50:32 PDT
Created
attachment 8165
[details]
Proposed patch The patch simply checks on attribute change whether there are any attribute selectors, if so it marks the element as changed. It seems to me this is not needed for mapped attributes, hence the entry == eNone check. Cheers, Rob.
Darin Adler
Comment 4
2006-05-08 20:01:42 PDT
Comment on
attachment 8165
[details]
Proposed patch Looks to me like this is one for Hyatt to review.
Maciej Stachowiak
Comment 5
2006-05-08 21:26:44 PDT
I don't think this fix is complete. An attribute selector could change the element from display:none to not, and when dispay:none, the element won't have a renderer. I suspect a better approach is to keep a hashtable of attribute names where there is a related attribute selector, and mark the element as changed whenever an attribute in that set is changed.
Maciej Stachowiak
Comment 6
2006-05-08 21:31:51 PDT
Created
attachment 8178
[details]
test case that I suspect won't work w/ this patch
Maciej Stachowiak
Comment 7
2006-05-08 21:33:09 PDT
Comment on
attachment 8165
[details]
Proposed patch r- because I don't think it will work in the case posted. I didn't try it though.
Rob Buis
Comment 8
2006-05-09 00:06:48 PDT
(In reply to
comment #6
)
> Created an attachment (id=8178) [edit] > test case that I suspect won't work w/ this patch >
I checked it and it does not work using my current patch. Though I assume it does not work without my patch either ;) Anyway, the hashtable approach sounds good to me, I'll work on it soon. Cheers, Rob.
Rob Buis
Comment 9
2006-05-10 00:57:31 PDT
Created
attachment 8202
[details]
New approach This new patch uses a Hashset. If the patch gets okayed, it is probably easy for me to merge the original testcase with Maciej's to make a good testcase for the patch. Cheers, Rob.
Rob Buis
Comment 10
2006-05-10 12:20:37 PDT
Created
attachment 8225
[details]
Now includes a testcase! I made some name changes after review from hyatt and othermaciej. Also I made a new testcase out of the original one, combined with Maciej's example testcase. Cheers, Rob.
Maciej Stachowiak
Comment 11
2006-05-11 00:43:31 PDT
Comment on
attachment 8225
[details]
Now includes a testcase! r=me
Darin Adler
Comment 12
2006-05-16 23:41:34 PDT
Had to move the test, because it does not belong in the css2.1 directory, and had to generate test results, not included here. Committed revision 14433.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug