-
-
Save rainyjune/4942479 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hasAttribute(e, a) { | |
if(e.hasAttribute) return e.hasAttribute(a); | |
var fixAttr = { | |
tabindex: 'tabIndex', | |
readonly: 'readOnly', | |
'for': 'htmlFor', | |
'class': 'className', | |
maxlength: 'maxLength', | |
cellspacing: 'cellSpacing', | |
cellpadding: 'cellPadding', | |
rowspan: 'rowSpan', | |
colspan: 'colSpan', | |
usemap: 'useMap', | |
frameborder: 'frameBorder', | |
contenteditable: 'contentEditable' | |
}; | |
var d = document.createElement("div"); | |
d.setAttribute("class", "yuanJS"); | |
var fullSupported = d.className === "yuanJS"; | |
return !!e.getAttribute(fullSupported ? a : (fixAttr[a] || a)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment