Does it enclose the element within a SPAN element with the given style or does it just assign the style to the attributes of the element itself? How about when I do element.style.border='1px solid red'? Does it depend on the browser or is there a rule?
+5
A:
It always assigns them to the element's style itself. I know of no browser that would introduce additional HTML elements into the DOM after setting the style
property.
Pekka
2010-06-29 17:47:19
+1
A:
It just adds/changes the style attribute of the element in question, no other elements are created ever
Ramuns Usovs
2010-06-29 17:50:17
+3
A:
The styling would be assigned to the element's style attribute. For example:
var myDiv = document.getElementById('outlined');
myDiv.style.border='1px solid red';
Would turn <div id="outlined"></div>
into:
<div id="outlined" style="border: 1px solid red;"></div>
idio
2010-06-29 18:05:26