Hacker News new | past | comments | ask | show | jobs | submit login

"So if there's no rules mentioning an [a] attribute in the page, el.setAttribute("a", ...) will generally not do anything."

That's true in general but there are exceptions as usual. Changing @href may trigger not only [href] rules but also :link ones. And :link rules are always present at least in default style sheet. @value triggers :empty. And so on.

But if someone in some library in galaxy far far away (small library used by your application) will add that [a] rule then magically you will get a spike on innocuous el.setAttribute("a", ...) calls in your code.

That's one of points of having transactional yet explicit DOM update mechanism. We have jQuery, Angulars, React, Ember, Vue, (you name it) that definitely need such thing. Sites/webapps that do not use one of those are quite rare these days.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: