Created
January 9, 2010 01:23
-
-
Save sdesai/272644 to your computer and use it in GitHub Desktop.
This file contains 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
var CLASS_NAME = "className", | |
BOUNDING_BOX = "boundingBox", | |
SKIN_PREFIX = "yui-skin-", | |
// ideally get [\s^] to work, instead of non-capturing group | |
SKIN_REGEXP = new RegExp("(?:^|\\s)(" + SKIN_PREFIX + "[^\\s$]+)"); | |
... | |
getSkinClass : function() { | |
var match; | |
this.get(BOUNDING_BOX).ancestor( | |
function(n) { | |
match = n.get(CLASS_NAME).match(SKIN_REGEXP); | |
return match; | |
} | |
); | |
return (match && match[1] || null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment