termi / ES5-DOM-SHIM

Lightweight ES5 and DOM shim with IE6 and IE7 support
143 stars 16 forks source link

fix [set/get/remove]Attribute #5

Open termi opened 12 years ago

termi commented 12 years ago

MDSN: getAttribute method setAttribute method removeAttribute method

For resolve problems with properties and attributes in IE < 8, we can use second parameter in [get/remove]Attribute and third parameter in setAttribute.

var div = document.createElement("div");
div.testValue = 666;
div.setAttribute("testValue", "lolcat");
console.log("property value: " + div.testValue, " ", "attribute value: " + div.getAttribute("testValue"));

div.testValue = 666;
div.setAttribute("TESTVALUE", "lolcat", 1);
console.log("property value: " + div.testValue, " ", "attribute value: " + div.getAttribute("TESTVALUE", 1));
termi commented 12 years ago

for IE8 Element.prototype.[set/get/remove]Attribute