stylesheet-debug.js revision 00f5227c72bff2a1b314aff7ee1829c303e74462
sheets = {},
var p;
}
switch (prop) {
case 'opacity':
case 'font' :
break;
default :
for (p in style) {
style[p] = '';
}
}
}
}
} :
}
if (prop === 'opacity') {
} else {
}
}
};
var head,
node,
cssRules = {},
// Factory or constructor
}
if (!head) {
Y.fail('HEAD element not found to append STYLE node');
}
// TODO: use DOM?
}
}
if (typeof seed === 'string') {
// Create entire sheet from seed cssText
// Not a load-time fork because low run-time impact and IE fails
// test for s.styleSheet at page load time (oddly)
if (node.styleSheet) {
} else {
}
} else if (!name) {
}
}
// styleSheet isn't available on the style node in FF2 until appended
// to the head element. style nodes appended to body do not affect
// change in Safari.
}
// IE stores StyleSheet under the "styleSheet" property
// IE stores the rules collection under the "rules" property
// IE supports removeRule
function (i) { sheet.deleteRule(i); } :
function (i) { sheet.removeRule(i); };
// IE supports addRule with different signature
// Initialize the cssRules map from the node
// TODO if xdomain link node, copy to a local style block and replace the
// link node with the style node. CAVEAT: alternate stylesheet, @media
// TODO: test existing node with funky selectors
// TODO: Split comma delimited rules
var i,r,sel;
sel = r.selectorText;
_deleteRule(i);
} else {
}
}
// Cache the sheet by the generated Id
if (name) {
}
// Public API
Y.mix(this,{
// while disabled.
/**
* Update style for a rule. Add the rule if it's not present already.
*
*/
idx;
// IE's addRule doesn't support multiple comma delimited selectors
}
return this;
}
// Some selector values can cause IE to hang
return this;
}
// Opera throws an error if there's a syntax error in assigned
// cssText. Avoid this using a worker styls collection, then
// assigning the resulting cssText.
if (rule) {
} else {
// Safari replaces the rules collection, but maintains the rule
}
return this;
},
// remove rule properties or an entire rule
rules, i;
if (rule) {
if (!remove) {
}
} else {
remove = true;
}
}
if (remove) { // remove the rule altogether
_deleteRule(i);
break;
}
}
}
}
return this;
}
},true);
}
}
// IE throws Invalid Value errors
try {
// IE doesn't like values with whitespace ala ' red' or 'red '
}
catch (e) {
}
}
}
};
Y.mix(StyleSheet, {
// input object's integrity, but if float and opacity are set, the input will
// be copied twice in IE. Is there a way to avoid this without increasing the
// byte count?
if ('opacity' in css) {
});
}
},
},
// TODO: Selector should provide
isValidSelector : function (sel) {
// IE locks up on addRule(BAD_SELECTOR, '{..}');
// BAD_SELECTOR : unescaped `~!@$%^&()+=|{}[];'"?< or space, ., or #
// followed by anything other than an alphanumeric
// -abc or .-abc or #_abc or '# ' all fail (prob more)
// TODO: this will fail tag[prop=val] tests
return !/[^\\][`~!@$%\^&()+=|{}\[\];'"?<]|^\s*[^a-z0-9*#.]|[\s.#][^a-z0-9]/i.test(sel);
}
});
Y.StyleSheet = StyleSheet;
/*
NOTES
* Style node must be added to the head element. Safari does not honor styles
applied to StyleSheet objects on style nodes in the body.
* StyleSheet object is created on the style node when the style node is added
to the head element in Firefox 2 (and maybe 3?)
* The cssRules collection is replaced after insertRule/deleteRule calls in
Safari 3.1. Existing Rules are used in the new collection, so the collection
cannot be cached, but the rules can be.
* Opera requires that the index be passed with insertRule.
* Same-domain restrictions prevent modifying StyleSheet objects attached to
link elements with remote href (or "about:blank" or "javascript:false")
* IE names StyleSheet related properties and methods differently (see code)
* IE converts tag names to upper case in the Rule's selectorText
You have to remove the rule altogether.
* Stylesheet properties set with !important will trump inline style set on an
element or in el.style.property.
* Creating a worker style collection like document.createElement('p').style;
will fail after a time in FF (~5secs of inactivity). Property assignments
will not alter the property or cssText. It may be the generated node is
garbage collected and the style collection becomes inert (speculation).
* IE locks up when attempting to add a rule with a selector including at least
characters {[]}~`!@%^&*()+=|? (unescaped) and leading _ or -
* When creating an entire sheet at once, only FF2/3 & Opera allow creating a
style node, setting its innerHTML and appending to head.
* When creating an entire sheet at once, Safari requires the style node to be
created with content in innerHTML of another element.
* When creating an entire sheet at once, IE requires the style node content to
be set via node.styleSheet.cssText
* When creating an entire sheet at once in IE, styleSheet.cssText can't be
---------- ----------------- --- --- ---- --- --- ------ -----
*/
}, '@VERSION@' );