Wednesday, January 2, 2013

dojo/dom-class vs. native classList

1) html 5 supports classList

2) dojo implementation is not using these native methods, and is slow compared to native variants:

Here is (my) draft of improvement:
(last method "Has Class - Dojo - with feature detection" and naive has(), contains1() methods)

Native support detection issue is also mentioned in bug discussions (currently closed as 'rejected'):

More, it is marked as "posterity" in latest source code (line 43):

3) Many HTML5 support detections are still missing in has.js: 

IMHO, about classList, only pull request from brianforbes, 2 years old (quite ugly):

For the beginning, we are comparing:
Has Class - Dojo
domClass.contains("single_class", "a_class");
Has Class - HTML5
classList contains with dojo byId
Has Class - Dojo - with feature detection
domClass.contains1("single_class", "a_class");

No comments:

Post a Comment