Skip to content

Instantly share code, notes, and snippets.

@sdesai
Created January 22, 2010 22:41
Show Gist options
  • Save sdesai/284240 to your computer and use it in GitHub Desktop.
Save sdesai/284240 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="http://yui.yahooapis.com/3.0.0/build/yui/yui.js"></script>
<script src="http://prototypejs.org/assets/2009/8/31/prototype.js"
type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
YUI({filter:"raw"}).use("overlay","node", function(Y) {
// WORKAROUND
Y.Selector._parsers[0] = {
name: 'attributes',
re: /^\[([a-z]+\w*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i,
fn: function(match, token) {
var operator = match[2] || '',
operators = Y.Selector.operators,
test;
// add prefiltering for ID and CLASS
if ((match[1] === 'id' && operator === '=') ||
(match[1] === 'className' &&
// WORKAROUND: use documentElement, instead of document
document.documentElement.getElementsByClassName &&
(operator === '~=' || operator === '='))) {
token.prefilter = match[1];
token[match[1]] = match[3];
}
// add tests
if (operator in operators) {
test = operators[operator];
if (typeof test === 'string') {
test = Y.Selector._getRegExp(test.replace('{val}', match[3]));
}
match[2] = test;
}
if (!token.last || token.prefilter !== match[1]) {
return match.slice(1);
}
}
};
function init() {
var overlay = new Y.Overlay({
headerContent:"My Overlay Header",
bodyContent:"My Overlay Body",
footerContent:"My Footer Content"
});
overlay.render();
}
Y.on("domready", init);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment