Skip to content
Permalink
Browse files

Core: Moved regex declarations for potential speed increase.

  • Loading branch information...
scottgonzalez committed Nov 7, 2008
1 parent 8cde747 commit 16c61e43f439de40c781845e22dfbfa577ee7cad
Showing with 21 additions and 21 deletions.
  1. +21 −21 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

0 comments on commit 16c61e4

Please sign in to comment.
You can’t perform that action at this time.