Skip to content

Commit

Permalink
Core: Moved regex declarations for potential speed increase.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed Nov 7, 2008
1 parent 8cde747 commit 16c61e4
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions ui/ui.core.js
Expand Up @@ -39,9 +39,8 @@ $.keyCode = {
UP: 38 UP: 38
}; };


//Temporary mappings var _remove = $.fn.remove,
var _remove = $.fn.remove; isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);
var isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);




//Helper functions and ui object //Helper functions and ui object
Expand Down Expand Up @@ -110,24 +109,25 @@ $.ui = {


// WAI-ARIA normalization // WAI-ARIA normalization
// tweak $.attr for FF2 implementation // tweak $.attr for FF2 implementation
if (isFF2){ if (isFF2) {

var attr = $.attr,
var attr = $.attr; ariaState = /^aria-/,
$.attr = function(elem, name, value) { ariaRole = /^wairole:/;
var set = value !== undefined,
state = /^aria-/;


return (name == 'role' $.attr = function(elem, name, value) {
? (set var set = value !== undefined;
? attr.call(this, elem, name, "wairole:" + value)
: (attr.apply(this, arguments) || "").replace(/^wairole:/, "")) return (name == 'role'
: (state.test(name)
? (set ? (set
? elem.setAttributeNS("http://www.w3.org/2005/07/aaa", name.replace(state, "aaa:"), value) ? attr.call(this, elem, name, "wairole:" + value)
: attr.call(this, elem, name.replace(state, "aaa:"))) : (attr.apply(this, arguments) || "").replace(ariaRole, ""))
: attr.apply(this,arguments))); : (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 //jQuery plugins
Expand Down Expand Up @@ -170,7 +170,7 @@ $.extend($.expr[':'], {
tabbable: function(a, i, m) { tabbable: function(a, i, m) {


var nodeName = a.nodeName.toLowerCase(); var nodeName = a.nodeName.toLowerCase();
var isVisible = function(element) { function isVisible(element) {
function checkStyles(element) { function checkStyles(element) {
var style = element.style; var style = element.style;
return (style.display != 'none' && style.visibility != 'hidden'); return (style.display != 'none' && style.visibility != 'hidden');
Expand All @@ -183,7 +183,7 @@ $.extend($.expr[':'], {
})); }));


return visible; return visible;
}; }


return ( return (
// in tab order // in tab order
Expand Down

0 comments on commit 16c61e4

Please sign in to comment.