Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch for jQuery ticket #1954 (reading only)
diff --git a/src/attributes.js b/src/attributes.js
index 5997210..1d1fcf8 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -211,6 +211,10 @@ jQuery.fn.extend({
return elem.getAttribute("value") === null ? "on" : elem.value;
}
+ if ( jQuery.nodeName( elem, "button" ) ) {
+ return elem.getAttributeNode( "value" ) ? elem.getAttributeNode( "value" ).nodeValue : "";
+ }
+
// Everything else, we just grab the value
return (elem.value || "").replace(rreturn, "");
@@ -336,6 +340,10 @@ jQuery.extend({
return elem.getAttributeNode( name ).nodeValue;
}
+ if ( name === "value" && jQuery.nodeName( elem, "button" ) ) {
+ return elem.getAttributeNode( name ) ? elem.getAttributeNode( name ).nodeValue : "";
+ }
+
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
if ( name === "tabIndex" ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.