ES5-DOM-SHIM
ES5-DOM-SHIM copied to clipboard
fix [set/get/remove]Attribute
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));
for IE8 Element.prototype.[set/get/remove]Attribute