xooie 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -14,9 +14,15 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- define('xooie/stylesheet', ['jquery'], function($) {
17
+ define('xooie/stylesheet', ['jquery', 'xooie/helpers'], function($, helpers) {
18
+
19
+
20
+ function nameCheck (index, name) {
21
+ return document.styleSheets[index].ownerNode.getAttribute('id') === name;
22
+ }
23
+
18
24
  var Stylesheet = function(name){
19
- var i, title;
25
+ var title;
20
26
 
21
27
  //check to see if a stylesheet already exists with this name
22
28
  this.element = $('style[id=' + name + ']');
@@ -30,17 +36,11 @@ define('xooie/stylesheet', ['jquery'], function($) {
30
36
  this.element.appendTo($('head'));
31
37
  }
32
38
 
33
- if (document.styleSheets) {
34
- for (i = 0; i < document.styleSheets.length; i += 1){
35
- if (document.styleSheets[i].ownerNode.getAttribute('id') === name) {
36
- this._index = i;
37
- }
38
- }
39
- }
39
+ this._name = name;
40
40
  };
41
41
 
42
42
  Stylesheet.prototype.get = function(){
43
- return document.styleSheets[this._index];
43
+ return document.styleSheets[this.getIndex()];
44
44
  };
45
45
 
46
46
  Stylesheet.prototype.getRule = function(ruleName){
@@ -109,6 +109,25 @@ define('xooie/stylesheet', ['jquery'], function($) {
109
109
  return false;
110
110
  };
111
111
 
112
+ Stylesheet.prototype.getIndex = function() {
113
+ var i;
114
+
115
+ if (helpers.isUndefined(document.styleSheets)) {
116
+ return;
117
+ }
118
+
119
+ if (!helpers.isUndefined(this._index) && nameCheck(this._index, this._name)) {
120
+ return this._index;
121
+ } else {
122
+ for (i = 0; i < document.styleSheets.length; i += 1){
123
+ if (nameCheck(i, this._name)) {
124
+ this._index = i;
125
+ return i;
126
+ }
127
+ }
128
+ }
129
+ };
130
+
112
131
  return Stylesheet;
113
132
 
114
133
  });
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright 2012 Comcast
2
+ * Copyright 2013 Comcast
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: xooie
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.2
5
+ version: 1.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrew Larkin
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2013-11-11 00:00:00 Z
13
+ date: 2013-11-15 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: A highly modular, extensible JavaScript UI framework.