diff options
author | Scott González <scott.gonzalez@gmail.com> | 2008-11-07 02:25:52 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2008-11-07 02:25:52 +0000 |
commit | 16c61e43f439de40c781845e22dfbfa577ee7cad (patch) | |
tree | 3dfd2e3895f907d9568f47d53a227c728001d548 /ui/ui.core.js | |
parent | 8cde7476d36836b24fceb1043386bb445624a345 (diff) | |
download | jquery-ui-16c61e43f439de40c781845e22dfbfa577ee7cad.tar.gz jquery-ui-16c61e43f439de40c781845e22dfbfa577ee7cad.zip |
Core: Moved regex declarations for potential speed increase.
Diffstat (limited to 'ui/ui.core.js')
-rw-r--r-- | ui/ui.core.js | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/ui/ui.core.js b/ui/ui.core.js index 5c4f481eb..904469350 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -39,9 +39,8 @@ $.keyCode = { UP: 38 }; -//Temporary mappings -var _remove = $.fn.remove; -var isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9); +var _remove = $.fn.remove, + isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9); //Helper functions and ui object @@ -110,24 +109,25 @@ $.ui = { // WAI-ARIA normalization // tweak $.attr for FF2 implementation -if (isFF2){ - -var attr = $.attr; -$.attr = function(elem, name, value) { - var set = value !== undefined, - state = /^aria-/; +if (isFF2) { + var attr = $.attr, + ariaState = /^aria-/, + ariaRole = /^wairole:/; - return (name == 'role' - ? (set - ? attr.call(this, elem, name, "wairole:" + value) - : (attr.apply(this, arguments) || "").replace(/^wairole:/, "")) - : (state.test(name) + $.attr = function(elem, name, value) { + var set = value !== undefined; + + return (name == 'role' ? (set - ? elem.setAttributeNS("http://www.w3.org/2005/07/aaa", name.replace(state, "aaa:"), value) - : attr.call(this, elem, name.replace(state, "aaa:"))) - : attr.apply(this,arguments))); -}; - + ? attr.call(this, elem, name, "wairole:" + value) + : (attr.apply(this, arguments) || "").replace(ariaRole, "")) + : (ariaState.test(name) + ? (set + ? elem.setAttributeNS("http://www.w3.org/2005/07/aaa", + name.replace(ariaState, "aaa:"), value) + : attr.call(this, elem, name.replace(ariaState, "aaa:"))) + : attr.apply(this, arguments))); + }; } //jQuery plugins @@ -170,7 +170,7 @@ $.extend($.expr[':'], { tabbable: function(a, i, m) { var nodeName = a.nodeName.toLowerCase(); - var isVisible = function(element) { + function isVisible(element) { function checkStyles(element) { var style = element.style; return (style.display != 'none' && style.visibility != 'hidden'); @@ -183,7 +183,7 @@ $.extend($.expr[':'], { })); return visible; - }; + } return ( // in tab order |