You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
12569
12571
12570
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
12572
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12571
12573
12572
-
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
12574
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
12573
12575
12574
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
12576
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12581
+
12582
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
12583
+
12584
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12577
12717
12578
12718
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -12581,6 +12721,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
12581
12721
12582
12722
12583
12723
var log = debug__WEBPACK_IMPORTED_MODULE_0___default()("WebIO:Node");
12724
+
12584
12725
/**
12585
12726
* A high-level "point-of-entry" under which WebIO "things" are rendered.
12586
12727
*
@@ -12602,49 +12743,14 @@ function () {
12602
12743
this.webIO = webIO;
12603
12744
}
12604
12745
/**
12605
-
* Set the `innerHTML` attribute of the node's element.
12606
-
*
12607
-
* This method will guarantee the execution of `<script />`s which is not done
12608
-
* by simply setting `element.innerHTML = ...`.
12609
-
*
12610
-
* @param html - The HTML string to use; any special HTML characters (`<`, `>`, `&`, etc.)
12611
-
* should be &-escaped as appropriate (e.g. to set the displayed text to "foo&bar",
12612
-
* `html` should be `foo&bar`).
12746
+
* Set the innerHTML of the node's DOM element.
12613
12747
*/
12614
12748
12615
12749
12616
12750
_createClass(WebIONode, [{
12617
12751
key: "setInnerHTML",
12618
12752
value: function setInnerHTML(html) {
12619
-
// In the original WebIO, we like to replace </script> with </_script> because the whole shebang
12620
-
// is executed inside a <script></script> block (and we don't want to close it too early).
12621
-
html = html.replace(/<\/_script>/g, "</script>");
12622
-
log("setInnerHTML", html);
12623
-
this.element.innerHTML = html; // If the HTML contained any <script> tags, these are NOT executed when we assign the DOM
12624
-
// innerHTML attribute, so we have to find-and-replace them to force them to execute.
12625
-
// We do this weird array coercion because getElementsByTagName returns a
12626
-
// HTMLCollection object, which updates as the contents of element update
12627
-
// (creating an infinite loop).
12628
-
12629
-
var scripts = _toConsumableArray(this.element.getElementsByTagName("script"));
12630
-
12631
-
scripts.forEach(function (oldScript) {
12632
-
var newScript = document.createElement("script"); // Copy all attributes.
12633
-
// Unfortunately, attributes is a NamedNodeMap which doesn't have very
12634
-
// ES6-like methods of manipulation
12635
-
12636
-
for (var i = 0; i < oldScript.attributes.length; ++i) {
12637
-
var _oldScript$attributes = oldScript.attributes[i],
12638
-
name = _oldScript$attributes.name,
12639
-
value = _oldScript$attributes.value;
12640
-
newScript.setAttribute(name, value);
12641
-
} // Copy script content
12642
-
12643
-
12644
-
newScript.appendChild(document.createTextNode(oldScript.innerHTML)); // Replace inside DOM
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
13817
+
13818
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
13819
+
13820
+
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
13821
+
13822
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
13823
+
13824
+
/**
13825
+
* Set the `innerHTML` attribute of a DOM element.
13826
+
*
13827
+
* This method will guarantee the execution of `<script />`s which is not done
13828
+
* by simply setting `element.innerHTML = ...`.
13829
+
*
13830
+
* @param element - The DOM element whose `innerHTML` will be set.
13831
+
* @param html - The HTML string to use; any special HTML characters (`<`, `>`, `&`, etc.)
13832
+
* should be &-escaped as appropriate (e.g. to set the displayed text to "foo&bar",
13833
+
* `html` should be `foo&bar`).
13834
+
*/
13835
+
var setInnerHTML = function setInnerHTML(element, html) {
13836
+
// In the original WebIO, we like to replace </script> with </_script> because the whole shebang
13837
+
// is executed inside a <script></script> block (and we don't want to close it too early).
13838
+
html = html.replace(/<\/_script>/g, "</script>");
13839
+
element.innerHTML = html; // If the HTML contained any <script> tags, these are NOT executed when we assign the DOM
13840
+
// innerHTML attribute, so we have to find-and-replace them to force them to execute.
13841
+
// We do this weird array coercion because getElementsByTagName returns a
13842
+
// HTMLCollection object, which updates as the contents of element update
13843
+
// (creating an infinite loop).
13844
+
13845
+
var scripts = _toConsumableArray(element.getElementsByTagName("script"));
13846
+
13847
+
scripts.forEach(function (oldScript) {
13848
+
var newScript = document.createElement("script"); // Copy all attributes.
13849
+
// Unfortunately, attributes is a NamedNodeMap which doesn't have very
13850
+
// ES6-like methods of manipulation
13851
+
13852
+
for (var i = 0; i < oldScript.attributes.length; ++i) {
13853
+
var _oldScript$attributes = oldScript.attributes[i],
13854
+
name = _oldScript$attributes.name,
13855
+
value = _oldScript$attributes.value;
13856
+
newScript.setAttribute(name, value);
13857
+
} // Copy script content
13858
+
13859
+
13860
+
newScript.appendChild(document.createTextNode(oldScript.innerHTML)); // Replace inside DOM
0 commit comments