StyleSheet.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //.CommonJS
  2. var CSSOM = {
  3. MediaList: require("./MediaList").MediaList
  4. };
  5. ///CommonJS
  6. /**
  7. * @see http://dev.w3.org/csswg/cssom/#the-stylesheet-interface
  8. */
  9. CSSOM.StyleSheet = function StyleSheet() {
  10. this.__href = null;
  11. this.__ownerNode = null;
  12. this.__title = null;
  13. this.__media = new CSSOM.MediaList();
  14. this.__parentStyleSheet = null;
  15. this.disabled = false;
  16. };
  17. Object.defineProperties(CSSOM.StyleSheet.prototype, {
  18. type: {
  19. get: function() {
  20. return "text/css";
  21. }
  22. },
  23. href: {
  24. get: function() {
  25. return this.__href;
  26. }
  27. },
  28. ownerNode: {
  29. get: function() {
  30. return this.__ownerNode;
  31. }
  32. },
  33. title: {
  34. get: function() {
  35. return this.__title;
  36. }
  37. },
  38. media: {
  39. get: function() {
  40. return this.__media;
  41. },
  42. set: function(value) {
  43. if (typeof value === "string") {
  44. this.__media.mediaText = value;
  45. } else {
  46. this.__media = value;
  47. }
  48. }
  49. },
  50. parentStyleSheet: {
  51. get: function() {
  52. return this.__parentStyleSheet;
  53. }
  54. }
  55. });
  56. //.CommonJS
  57. exports.StyleSheet = CSSOM.StyleSheet;
  58. ///CommonJS