polymer-rails 1.0.0 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@
7
7
  * Code distributed by Google as part of the polymer project is also
8
8
  * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
9
  */
10
- // @version 0.7.2
10
+ // @version 0.7.3
11
11
  window.WebComponents = window.WebComponents || {};
12
12
 
13
13
  (function(scope) {
@@ -52,7 +52,7 @@ window.WebComponents = window.WebComponents || {};
52
52
  window.CustomElements.flags.register = flags.register;
53
53
  }
54
54
  scope.flags = flags;
55
- })(WebComponents);
55
+ })(window.WebComponents);
56
56
 
57
57
  (function(scope) {
58
58
  "use strict";
@@ -164,7 +164,7 @@ window.WebComponents = window.WebComponents || {};
164
164
 
165
165
  case "scheme data":
166
166
  if ("?" == c) {
167
- query = "?";
167
+ this._query = "?";
168
168
  state = "query";
169
169
  } else if ("#" == c) {
170
170
  this._fragment = "#";
@@ -1052,7 +1052,7 @@ window.HTMLImports = window.HTMLImports || {
1052
1052
  scope.rootDocument = rootDocument;
1053
1053
  scope.whenReady = whenReady;
1054
1054
  scope.isIE = isIE;
1055
- })(HTMLImports);
1055
+ })(window.HTMLImports);
1056
1056
 
1057
1057
  (function(scope) {
1058
1058
  var modules = [];
@@ -1066,9 +1066,9 @@ window.HTMLImports = window.HTMLImports || {
1066
1066
  };
1067
1067
  scope.addModule = addModule;
1068
1068
  scope.initializeModules = initializeModules;
1069
- })(HTMLImports);
1069
+ })(window.HTMLImports);
1070
1070
 
1071
- HTMLImports.addModule(function(scope) {
1071
+ window.HTMLImports.addModule(function(scope) {
1072
1072
  var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
1073
1073
  var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
1074
1074
  var path = {
@@ -1098,7 +1098,7 @@ HTMLImports.addModule(function(scope) {
1098
1098
  scope.path = path;
1099
1099
  });
1100
1100
 
1101
- HTMLImports.addModule(function(scope) {
1101
+ window.HTMLImports.addModule(function(scope) {
1102
1102
  var xhr = {
1103
1103
  async: true,
1104
1104
  ok: function(request) {
@@ -1130,7 +1130,7 @@ HTMLImports.addModule(function(scope) {
1130
1130
  scope.xhr = xhr;
1131
1131
  });
1132
1132
 
1133
- HTMLImports.addModule(function(scope) {
1133
+ window.HTMLImports.addModule(function(scope) {
1134
1134
  var xhr = scope.xhr;
1135
1135
  var flags = scope.flags;
1136
1136
  var Loader = function(onLoad, onComplete) {
@@ -1223,7 +1223,7 @@ HTMLImports.addModule(function(scope) {
1223
1223
  scope.Loader = Loader;
1224
1224
  });
1225
1225
 
1226
- HTMLImports.addModule(function(scope) {
1226
+ window.HTMLImports.addModule(function(scope) {
1227
1227
  var Observer = function(addCallback) {
1228
1228
  this.addCallback = addCallback;
1229
1229
  this.mo = new MutationObserver(this.handler.bind(this));
@@ -1256,7 +1256,7 @@ HTMLImports.addModule(function(scope) {
1256
1256
  scope.Observer = Observer;
1257
1257
  });
1258
1258
 
1259
- HTMLImports.addModule(function(scope) {
1259
+ window.HTMLImports.addModule(function(scope) {
1260
1260
  var path = scope.path;
1261
1261
  var rootDocument = scope.rootDocument;
1262
1262
  var flags = scope.flags;
@@ -1488,7 +1488,7 @@ HTMLImports.addModule(function(scope) {
1488
1488
  scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
1489
1489
  });
1490
1490
 
1491
- HTMLImports.addModule(function(scope) {
1491
+ window.HTMLImports.addModule(function(scope) {
1492
1492
  var flags = scope.flags;
1493
1493
  var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
1494
1494
  var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
@@ -1587,7 +1587,7 @@ HTMLImports.addModule(function(scope) {
1587
1587
  scope.importLoader = importLoader;
1588
1588
  });
1589
1589
 
1590
- HTMLImports.addModule(function(scope) {
1590
+ window.HTMLImports.addModule(function(scope) {
1591
1591
  var parser = scope.parser;
1592
1592
  var importer = scope.importer;
1593
1593
  var dynamic = {
@@ -1643,7 +1643,7 @@ HTMLImports.addModule(function(scope) {
1643
1643
  } else {
1644
1644
  document.addEventListener("DOMContentLoaded", bootstrap);
1645
1645
  }
1646
- })(HTMLImports);
1646
+ })(window.HTMLImports);
1647
1647
 
1648
1648
  window.CustomElements = window.CustomElements || {
1649
1649
  flags: {}
@@ -1664,9 +1664,9 @@ window.CustomElements = window.CustomElements || {
1664
1664
  scope.initializeModules = initializeModules;
1665
1665
  scope.hasNative = Boolean(document.registerElement);
1666
1666
  scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
1667
- })(CustomElements);
1667
+ })(window.CustomElements);
1668
1668
 
1669
- CustomElements.addModule(function(scope) {
1669
+ window.CustomElements.addModule(function(scope) {
1670
1670
  var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
1671
1671
  function forSubtree(node, cb) {
1672
1672
  findAllElements(node, function(e) {
@@ -1721,7 +1721,7 @@ CustomElements.addModule(function(scope) {
1721
1721
  scope.forSubtree = forSubtree;
1722
1722
  });
1723
1723
 
1724
- CustomElements.addModule(function(scope) {
1724
+ window.CustomElements.addModule(function(scope) {
1725
1725
  var flags = scope.flags;
1726
1726
  var forSubtree = scope.forSubtree;
1727
1727
  var forDocumentTree = scope.forDocumentTree;
@@ -1917,7 +1917,7 @@ CustomElements.addModule(function(scope) {
1917
1917
  scope.takeRecords = takeRecords;
1918
1918
  });
1919
1919
 
1920
- CustomElements.addModule(function(scope) {
1920
+ window.CustomElements.addModule(function(scope) {
1921
1921
  var flags = scope.flags;
1922
1922
  function upgrade(node) {
1923
1923
  if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
@@ -1977,7 +1977,7 @@ CustomElements.addModule(function(scope) {
1977
1977
  scope.implementPrototype = implementPrototype;
1978
1978
  });
1979
1979
 
1980
- CustomElements.addModule(function(scope) {
1980
+ window.CustomElements.addModule(function(scope) {
1981
1981
  var isIE11OrOlder = scope.isIE11OrOlder;
1982
1982
  var upgradeDocumentTree = scope.upgradeDocumentTree;
1983
1983
  var upgradeAll = scope.upgradeAll;
@@ -7,7 +7,7 @@
7
7
  * Code distributed by Google as part of the polymer project is also
8
8
  * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
9
9
  */
10
- // @version 0.7.2
10
+ // @version 0.7.3
11
11
  window.WebComponents = window.WebComponents || {};
12
12
 
13
13
  (function(scope) {
@@ -158,7 +158,7 @@ if (WebComponents.flags.shadow) {
158
158
  defineProperty(object, name, nonEnumerableDataDescriptor);
159
159
  }
160
160
  getOwnPropertyNames(window);
161
- function getWrapperConstructor(node) {
161
+ function getWrapperConstructor(node, opt_instance) {
162
162
  var nativePrototype = node.__proto__ || Object.getPrototypeOf(node);
163
163
  if (isFirefox) {
164
164
  try {
@@ -171,7 +171,7 @@ if (WebComponents.flags.shadow) {
171
171
  if (wrapperConstructor) return wrapperConstructor;
172
172
  var parentWrapperConstructor = getWrapperConstructor(nativePrototype);
173
173
  var GeneratedWrapper = createWrapperConstructor(parentWrapperConstructor);
174
- registerInternal(nativePrototype, GeneratedWrapper, node);
174
+ registerInternal(nativePrototype, GeneratedWrapper, opt_instance);
175
175
  return GeneratedWrapper;
176
176
  }
177
177
  function addForwardingProperties(nativePrototype, wrapperPrototype) {
@@ -231,8 +231,10 @@ if (WebComponents.flags.shadow) {
231
231
  }
232
232
  var descriptor = getDescriptor(source, name);
233
233
  var getter, setter;
234
- if (allowMethod && typeof descriptor.value === "function") {
235
- target[name] = getMethod(name);
234
+ if (typeof descriptor.value === "function") {
235
+ if (allowMethod) {
236
+ target[name] = getMethod(name);
237
+ }
236
238
  continue;
237
239
  }
238
240
  var isEvent = isEventHandlerName(name);
@@ -295,7 +297,11 @@ if (WebComponents.flags.shadow) {
295
297
  function wrap(impl) {
296
298
  if (impl === null) return null;
297
299
  assert(isNative(impl));
298
- return impl.__wrapper8e3dd93a60__ || (impl.__wrapper8e3dd93a60__ = new (getWrapperConstructor(impl))(impl));
300
+ var wrapper = impl.__wrapper8e3dd93a60__;
301
+ if (wrapper != null) {
302
+ return wrapper;
303
+ }
304
+ return impl.__wrapper8e3dd93a60__ = new (getWrapperConstructor(impl, impl))(impl);
299
305
  }
300
306
  function unwrap(wrapper) {
301
307
  if (wrapper === null) return null;
@@ -4963,7 +4969,7 @@ if (WebComponents.flags.shadow) {
4963
4969
 
4964
4970
  case "scheme data":
4965
4971
  if ("?" == c) {
4966
- query = "?";
4972
+ this._query = "?";
4967
4973
  state = "query";
4968
4974
  } else if ("#" == c) {
4969
4975
  this._fragment = "#";
@@ -5815,7 +5821,7 @@ window.HTMLImports = window.HTMLImports || {
5815
5821
  scope.rootDocument = rootDocument;
5816
5822
  scope.whenReady = whenReady;
5817
5823
  scope.isIE = isIE;
5818
- })(HTMLImports);
5824
+ })(window.HTMLImports);
5819
5825
 
5820
5826
  (function(scope) {
5821
5827
  var modules = [];
@@ -5829,9 +5835,9 @@ window.HTMLImports = window.HTMLImports || {
5829
5835
  };
5830
5836
  scope.addModule = addModule;
5831
5837
  scope.initializeModules = initializeModules;
5832
- })(HTMLImports);
5838
+ })(window.HTMLImports);
5833
5839
 
5834
- HTMLImports.addModule(function(scope) {
5840
+ window.HTMLImports.addModule(function(scope) {
5835
5841
  var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
5836
5842
  var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
5837
5843
  var path = {
@@ -5861,7 +5867,7 @@ HTMLImports.addModule(function(scope) {
5861
5867
  scope.path = path;
5862
5868
  });
5863
5869
 
5864
- HTMLImports.addModule(function(scope) {
5870
+ window.HTMLImports.addModule(function(scope) {
5865
5871
  var xhr = {
5866
5872
  async: true,
5867
5873
  ok: function(request) {
@@ -5893,7 +5899,7 @@ HTMLImports.addModule(function(scope) {
5893
5899
  scope.xhr = xhr;
5894
5900
  });
5895
5901
 
5896
- HTMLImports.addModule(function(scope) {
5902
+ window.HTMLImports.addModule(function(scope) {
5897
5903
  var xhr = scope.xhr;
5898
5904
  var flags = scope.flags;
5899
5905
  var Loader = function(onLoad, onComplete) {
@@ -5986,7 +5992,7 @@ HTMLImports.addModule(function(scope) {
5986
5992
  scope.Loader = Loader;
5987
5993
  });
5988
5994
 
5989
- HTMLImports.addModule(function(scope) {
5995
+ window.HTMLImports.addModule(function(scope) {
5990
5996
  var Observer = function(addCallback) {
5991
5997
  this.addCallback = addCallback;
5992
5998
  this.mo = new MutationObserver(this.handler.bind(this));
@@ -6019,7 +6025,7 @@ HTMLImports.addModule(function(scope) {
6019
6025
  scope.Observer = Observer;
6020
6026
  });
6021
6027
 
6022
- HTMLImports.addModule(function(scope) {
6028
+ window.HTMLImports.addModule(function(scope) {
6023
6029
  var path = scope.path;
6024
6030
  var rootDocument = scope.rootDocument;
6025
6031
  var flags = scope.flags;
@@ -6251,7 +6257,7 @@ HTMLImports.addModule(function(scope) {
6251
6257
  scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
6252
6258
  });
6253
6259
 
6254
- HTMLImports.addModule(function(scope) {
6260
+ window.HTMLImports.addModule(function(scope) {
6255
6261
  var flags = scope.flags;
6256
6262
  var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
6257
6263
  var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
@@ -6350,7 +6356,7 @@ HTMLImports.addModule(function(scope) {
6350
6356
  scope.importLoader = importLoader;
6351
6357
  });
6352
6358
 
6353
- HTMLImports.addModule(function(scope) {
6359
+ window.HTMLImports.addModule(function(scope) {
6354
6360
  var parser = scope.parser;
6355
6361
  var importer = scope.importer;
6356
6362
  var dynamic = {
@@ -6406,7 +6412,7 @@ HTMLImports.addModule(function(scope) {
6406
6412
  } else {
6407
6413
  document.addEventListener("DOMContentLoaded", bootstrap);
6408
6414
  }
6409
- })(HTMLImports);
6415
+ })(window.HTMLImports);
6410
6416
 
6411
6417
  window.CustomElements = window.CustomElements || {
6412
6418
  flags: {}
@@ -6427,9 +6433,9 @@ window.CustomElements = window.CustomElements || {
6427
6433
  scope.initializeModules = initializeModules;
6428
6434
  scope.hasNative = Boolean(document.registerElement);
6429
6435
  scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
6430
- })(CustomElements);
6436
+ })(window.CustomElements);
6431
6437
 
6432
- CustomElements.addModule(function(scope) {
6438
+ window.CustomElements.addModule(function(scope) {
6433
6439
  var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
6434
6440
  function forSubtree(node, cb) {
6435
6441
  findAllElements(node, function(e) {
@@ -6484,7 +6490,7 @@ CustomElements.addModule(function(scope) {
6484
6490
  scope.forSubtree = forSubtree;
6485
6491
  });
6486
6492
 
6487
- CustomElements.addModule(function(scope) {
6493
+ window.CustomElements.addModule(function(scope) {
6488
6494
  var flags = scope.flags;
6489
6495
  var forSubtree = scope.forSubtree;
6490
6496
  var forDocumentTree = scope.forDocumentTree;
@@ -6680,7 +6686,7 @@ CustomElements.addModule(function(scope) {
6680
6686
  scope.takeRecords = takeRecords;
6681
6687
  });
6682
6688
 
6683
- CustomElements.addModule(function(scope) {
6689
+ window.CustomElements.addModule(function(scope) {
6684
6690
  var flags = scope.flags;
6685
6691
  function upgrade(node) {
6686
6692
  if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
@@ -6740,7 +6746,7 @@ CustomElements.addModule(function(scope) {
6740
6746
  scope.implementPrototype = implementPrototype;
6741
6747
  });
6742
6748
 
6743
- CustomElements.addModule(function(scope) {
6749
+ window.CustomElements.addModule(function(scope) {
6744
6750
  var isIE11OrOlder = scope.isIE11OrOlder;
6745
6751
  var upgradeDocumentTree = scope.upgradeDocumentTree;
6746
6752
  var upgradeAll = scope.upgradeAll;
@@ -4,10 +4,22 @@ module Polymer
4
4
  module Rails
5
5
  class Component
6
6
 
7
+ # HTML Encoding
7
8
  ENCODING = 'UTF-8'
9
+
10
+ # Nodes that should be parsed as XML nodes
8
11
  XML_NODES = ['*[selected]', '*[checked]', '*[src]:not(script)']
12
+
13
+ # XML options for to_xml method
9
14
  XML_OPTIONS = { save_with: Nokogiri::XML::Node::SaveOptions::NO_EMPTY_TAGS }
10
15
 
16
+ # Selectors for component resources
17
+ SELECTORS = {
18
+ html: "link[rel='import']:not([type='css'])",
19
+ stylesheet: "link[rel='stylesheet'], link[rel='import'][type='css']",
20
+ javascript: "script[src]"
21
+ }
22
+
11
23
  def initialize(data)
12
24
  @doc = ::Nokogiri::HTML5("<body>#{data}</body>")
13
25
  end
@@ -23,15 +35,17 @@ module Polymer
23
35
  end
24
36
 
25
37
  def stylesheets
26
- @doc.css("link[rel='stylesheet']").reject{|tag| is_external? tag.attributes['href'].value}
38
+ @doc.css(SELECTORS[:stylesheet]).reject{|tag| is_external? tag.attributes['href'].value}
27
39
  end
28
40
 
29
41
  def javascripts
30
- @doc.css("script[src]").reject{|tag| is_external? tag.attributes['src'].value}
42
+ @doc.css(SELECTORS[:javascript]).reject do |tag|
43
+ is_external? tag.attributes['src'].value
44
+ end
31
45
  end
32
46
 
33
- def imports
34
- @doc.css("link[rel='import']")
47
+ def html_imports
48
+ @doc.css(SELECTORS[:html])
35
49
  end
36
50
 
37
51
  private
@@ -19,7 +19,7 @@ module Polymer
19
19
  private
20
20
 
21
21
  def require_imports
22
- @component.imports.each do |import|
22
+ @component.html_imports.each do |import|
23
23
  @context.require_asset absolute_asset_path(import.attributes['href'].value)
24
24
  import.remove
25
25
  end
@@ -1,5 +1,5 @@
1
1
  module Polymer
2
2
  module Rails
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polymer-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Chaplinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-02 00:00:00.000000000 Z
11
+ date: 2015-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails