Skip to content

Instantly share code, notes, and snippets.

@sdesai
Created January 9, 2010 01:23
Show Gist options
  • Save sdesai/272644 to your computer and use it in GitHub Desktop.
Save sdesai/272644 to your computer and use it in GitHub Desktop.
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