Pregunta de entrevista de Groupon

What is unobtrusive javascript?

Respuesta de la entrevista

Anónimo

18 dic 2013

Unobtrusive JavaScript is a general term that conveys a general philosophy, similar to the term REST (Representational State Transfer). The high-level description is that unobtrusive JavaScript doesn’t intermix JavaScript code in your page markup. For example, rather than hooking in via event attributes like oncl1ck and onsubm1t, the unobtrusive JavaScript attaches to elements by their ID or class, often based on the presence of other attributes (such as HTML5 data- attributes). It’s got semantic meaning, and all of it — the tag structure, element attributes, and so on — should have a precise meaning. Strewing JavaScript gunk across the page to facilitate interaction (I’m looking at you, __doPostBack!) harms the content of the document.

1