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.

CSSGroupingRule.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //.CommonJS
  2. var CSSOM = {
  3. CSSRule: require("./CSSRule").CSSRule
  4. };
  5. ///CommonJS
  6. /**
  7. * @constructor
  8. * @see https://drafts.csswg.org/cssom/#the-cssgroupingrule-interface
  9. */
  10. CSSOM.CSSGroupingRule = function CSSGroupingRule() {
  11. CSSOM.CSSRule.call(this);
  12. this.cssRules = [];
  13. };
  14. CSSOM.CSSGroupingRule.prototype = new CSSOM.CSSRule();
  15. CSSOM.CSSGroupingRule.prototype.constructor = CSSOM.CSSGroupingRule;
  16. /**
  17. * Used to insert a new CSS rule to a list of CSS rules.
  18. *
  19. * @example
  20. * cssGroupingRule.cssText
  21. * -> "body{margin:0;}"
  22. * cssGroupingRule.insertRule("img{border:none;}", 1)
  23. * -> 1
  24. * cssGroupingRule.cssText
  25. * -> "body{margin:0;}img{border:none;}"
  26. *
  27. * @param {string} rule
  28. * @param {number} [index]
  29. * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-insertrule
  30. * @return {number} The index within the grouping rule's collection of the newly inserted rule.
  31. */
  32. CSSOM.CSSGroupingRule.prototype.insertRule = function insertRule(rule, index) {
  33. if (index < 0 || index > this.cssRules.length) {
  34. throw new RangeError("INDEX_SIZE_ERR");
  35. }
  36. var cssRule = CSSOM.parse(rule).cssRules[0];
  37. cssRule.parentRule = this;
  38. this.cssRules.splice(index, 0, cssRule);
  39. return index;
  40. };
  41. /**
  42. * Used to delete a rule from the grouping rule.
  43. *
  44. * cssGroupingRule.cssText
  45. * -> "img{border:none;}body{margin:0;}"
  46. * cssGroupingRule.deleteRule(0)
  47. * cssGroupingRule.cssText
  48. * -> "body{margin:0;}"
  49. *
  50. * @param {number} index within the grouping rule's rule list of the rule to remove.
  51. * @see https://www.w3.org/TR/cssom-1/#dom-cssgroupingrule-deleterule
  52. */
  53. CSSOM.CSSGroupingRule.prototype.deleteRule = function deleteRule(index) {
  54. if (index < 0 || index >= this.cssRules.length) {
  55. throw new RangeError("INDEX_SIZE_ERR");
  56. }
  57. this.cssRules.splice(index, 1)[0].parentRule = null;
  58. };
  59. //.CommonJS
  60. exports.CSSGroupingRule = CSSOM.CSSGroupingRule;
  61. ///CommonJS