Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

clone.js 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //.CommonJS
  2. var CSSOM = {
  3. CSSStyleSheet: require("./CSSStyleSheet").CSSStyleSheet,
  4. CSSRule: require("./CSSRule").CSSRule,
  5. CSSStyleRule: require("./CSSStyleRule").CSSStyleRule,
  6. CSSGroupingRule: require("./CSSGroupingRule").CSSGroupingRule,
  7. CSSConditionRule: require("./CSSConditionRule").CSSConditionRule,
  8. CSSMediaRule: require("./CSSMediaRule").CSSMediaRule,
  9. CSSSupportsRule: require("./CSSSupportsRule").CSSSupportsRule,
  10. CSSStyleDeclaration: require("./CSSStyleDeclaration").CSSStyleDeclaration,
  11. CSSKeyframeRule: require('./CSSKeyframeRule').CSSKeyframeRule,
  12. CSSKeyframesRule: require('./CSSKeyframesRule').CSSKeyframesRule
  13. };
  14. ///CommonJS
  15. /**
  16. * Produces a deep copy of stylesheet — the instance variables of stylesheet are copied recursively.
  17. * @param {CSSStyleSheet|CSSOM.CSSStyleSheet} stylesheet
  18. * @nosideeffects
  19. * @return {CSSOM.CSSStyleSheet}
  20. */
  21. CSSOM.clone = function clone(stylesheet) {
  22. var cloned = new CSSOM.CSSStyleSheet();
  23. var rules = stylesheet.cssRules;
  24. if (!rules) {
  25. return cloned;
  26. }
  27. for (var i = 0, rulesLength = rules.length; i < rulesLength; i++) {
  28. var rule = rules[i];
  29. var ruleClone = cloned.cssRules[i] = new rule.constructor();
  30. var style = rule.style;
  31. if (style) {
  32. var styleClone = ruleClone.style = new CSSOM.CSSStyleDeclaration();
  33. for (var j = 0, styleLength = style.length; j < styleLength; j++) {
  34. var name = styleClone[j] = style[j];
  35. styleClone[name] = style[name];
  36. styleClone._importants[name] = style.getPropertyPriority(name);
  37. }
  38. styleClone.length = style.length;
  39. }
  40. if (rule.hasOwnProperty('keyText')) {
  41. ruleClone.keyText = rule.keyText;
  42. }
  43. if (rule.hasOwnProperty('selectorText')) {
  44. ruleClone.selectorText = rule.selectorText;
  45. }
  46. if (rule.hasOwnProperty('mediaText')) {
  47. ruleClone.mediaText = rule.mediaText;
  48. }
  49. if (rule.hasOwnProperty('conditionText')) {
  50. ruleClone.conditionText = rule.conditionText;
  51. }
  52. if (rule.hasOwnProperty('cssRules')) {
  53. ruleClone.cssRules = clone(rule).cssRules;
  54. }
  55. }
  56. return cloned;
  57. };
  58. //.CommonJS
  59. exports.clone = CSSOM.clone;
  60. ///CommonJS