WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
95631
grumble
element.classList.remove("x") on an element with only class "x" leaves <p class> instead of <p class="">
https://bugs.webkit.org/show_bug.cgi?id=95631
Summary
element.classList.remove("x") on an element with only class "x" leaves <p cla...
Alex
Reported
2012-08-31 20:31:30 PDT
By inspecting the <h1> element in this jsFiddle, you can see that using classList.remove to remove the only class from an element results in, e.g., <h1 class>, when it seems that the right result is <h1 class="">:
http://jsfiddle.net/gyre/6rVJU/
The current HTML5 draft says that the class attribute, "if specified, must have a value" (
http://dev.w3.org/html5/spec-author-view/global-attributes.html#classes
). But neither the regular or "nu" W3 validators flag this as invalid, so I doubt it's important. Gecko does have the "correct" behavior, though. Tested on Safari 6.0 (8536.25), Webkit 537+, and Chrome 21.0.1180.89
Attachments
Add attachment
proposed patch, testcase, etc.
Ahmad Saleem
Comment 1
2022-08-05 16:13:41 PDT
I am unable to reproduce this bug using attached test case from
Comment 0
in Safari 15.6 on macOS 12.5. Clicking on "Whatever happened to class?" do nothing and does not generate any Console logs. It is similar in other browsers (Chrome Canary 106 and Firefox 105) and clicking on button do nothing. Considering it was working in Gecko (Firefox) before and they have changed their behavior. I would consider this as "RESOLVED INVALID" and mark accordingly. In case, if I am wrong or testing incorrectly, please comment or mark this bug accordingly. Thanks!
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