bem / html-differ

Сompares two HTML
http://bem.info/tools/testing/html-differ/
MIT License
212 stars 45 forks source link

Feat request: Should ignore duplicates in class names list #138

Closed qfox closed 8 years ago

qfox commented 8 years ago

<div class="popup welcome popup popup welcome"></div> should be equivalent to <div class="welcome popup"></div>

eGavr commented 8 years ago

Are you sure that it is necessary to do do ?

Could you give some links to spec ?

qfox commented 8 years ago

ex1:

var elem = document.createElement('div');
elem.className = 'popup popup open popup';
console.log(elem.classList); // ["popup", "popup", "open", "popup"]

ex2:

var elem = document.createElement('div');
elem.classList.add('popup')
elem.classList.add('popup')
elem.classList.add('open')
elem.classList.add('popup')
console.log(elem.classList); // ["popup", "open"]

https://www.w3.org/TR/html401/struct/global.html#h-7.5.2

eGavr commented 8 years ago

It should be an option or used by default?

qfox commented 8 years ago

I don't see why it should be hidden under option. It's like resorting class names inside class attribute.