Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Stop using NodeParent interface on DocumentFragments #1446

Merged
merged 1 commit into from

2 participants

António Afonso François Frisch
António Afonso
Owner

Both IE and Safari do not implement this interface on DocumentFragments.

António Afonso aadsm Stop using NodeParent interface on DocumentFragments
Both IE and Safari do not implement this interface on DocumentFragments.
b5555ae
François Frisch francoisfrisch merged commit 122c64e into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 10, 2014
  1. António Afonso

    Stop using NodeParent interface on DocumentFragments

    aadsm authored
    Both IE and Safari do not implement this interface on DocumentFragments.
This page is out of date. Refresh to see the latest.
Showing with 37 additions and 3 deletions.
  1. +37 −3 ui/component.js
40 ui/component.js
View
@@ -444,7 +444,7 @@ var Component = exports.Component = Target.specialize(/** @lends Component# */ {
range = template.document.createRange();
range.selectNodeContents(element);
argument = range.cloneContents();
- if (window._montage_le_flag && argument.children.length > 0) {
+ if (window._montage_le_flag && element.children.length > 0) {
this._leTagStarArgument(ownerModuleId, label, argument);
}
} else {
@@ -1863,10 +1863,44 @@ var Component = exports.Component = Target.specialize(/** @lends Component# */ {
}
},
+ _getNodeFirstElement: {
+ value: function(node) {
+ var element = node.firstElementChild;
+
+ if (!element) {
+ element = node.firstChild;
+ do {
+ if (element.nodeType === Node.ELEMENT_NODE) {
+ break;
+ }
+ } while (element =/*assign*/ element.nextSibling);
+ }
+
+ return element;
+ }
+ },
+
+ _getNodeLastElement: {
+ value: function(node) {
+ var element = node.lastElementChild;
+
+ if (!element) {
+ element = node.lastChild;
+ do {
+ if (element.nodeType === Node.ELEMENT_NODE) {
+ break;
+ }
+ } while (element =/*assign*/ element.previousSibling);
+ }
+
+ return element;
+ }
+ },
+
_leTagStarArgument: {
value: function(ownerModuleId, label, rootElement) {
- var argumentBegin = rootElement.firstElementChild;
- var argumentEnd = rootElement.lastElementChild;
+ var argumentBegin = this._getNodeFirstElement(rootElement);
+ var argumentEnd = this._getNodeLastElement(rootElement);
argumentBegin.setAttribute(ATTR_LE_ARG_BEGIN,
(argumentBegin.getAttribute(ATTR_LE_ARG_BEGIN)||"") + " " +
Something went wrong with that request. Please try again.