Bug 55758 - Web Inspector: Make use of element.classList in utilities.js
Summary: Web Inspector: Make use of element.classList in utilities.js
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-04 02:54 PST by Alexander Pavlov (apavlov)
Modified: 2011-03-11 01:27 PST (History)
10 users (show)

See Also:


Attachments
[PATCH] Suggested solution (4.06 KB, patch)
2011-03-04 03:14 PST, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] Trivial solution fix (4.07 KB, patch)
2011-03-04 04:20 PST, Alexander Pavlov (apavlov)
no flags Details | Formatted Diff | Diff
[PATCH] Removed unneeded methods on the Element.prototype altogether (156.25 KB, patch)
2011-03-04 09:09 PST, Alexander Pavlov (apavlov)
pfeldman: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov (apavlov) 2011-03-04 02:54:52 PST
element.classList is much faster than the regex-based processing of element.className
Comment 1 Alexander Pavlov (apavlov) 2011-03-04 03:14:26 PST
Created attachment 84720 [details]
[PATCH] Suggested solution
Comment 2 Alexander Pavlov (apavlov) 2011-03-04 04:20:07 PST
Created attachment 84724 [details]
[PATCH] Trivial solution fix
Comment 3 Pavel Feldman 2011-03-04 05:03:04 PST
Comment on attachment 84724 [details]
[PATCH] Trivial solution fix

View in context: https://bugs.webkit.org/attachment.cgi?id=84724&action=review

> Source/WebCore/inspector/front-end/utilities.js:169
> +Element.prototype.addStyleClass = function(classNames)

I'd get rid of our methods all together.
Comment 4 Alexander Pavlov (apavlov) 2011-03-04 09:09:36 PST
Created attachment 84759 [details]
[PATCH] Removed unneeded methods on the Element.prototype altogether
Comment 5 Pavel Feldman 2011-03-06 11:10:19 PST
Comment on attachment 84759 [details]
[PATCH] Removed unneeded methods on the Element.prototype altogether

Thanks for doing this. It is hard to land this with no regressions. Could you please split this change into two changes:
1) make sure that only single classes are passed into add/remove/hasStyleClass + migrate to using classList in the add/remove/hasStyleClass methods.
2) Inline classList.* in place of add/remove/hasStyleClass.
Comment 6 Alexander Pavlov (apavlov) 2011-03-11 01:27:13 PST
Bug 56096 fixes the first item, and we have agreed with pfeldman that the add/remove/hasStyleClass improve readability, so the classList methods will not be inlined. We have reached our primary goal of getting rid of regex-based operations and the className property modification (which is slow).