Skip to content

Commit

Permalink
MDL-44798 editor_atto: Backport a fix for HTML5Shiv
Browse files Browse the repository at this point in the history
This is a backport of the Rangy workaround for a bug in HTML5Shiv, which
breaks document.createElement by returning nodes which have parent nodes.

HTML5Shiv refuses to fix this bug so Rangy has had to work around it.

For more information see:
* https://code.google.com/p/rangy/issues/detail?id=104; and
* aFarkas/html5shiv#64.
  • Loading branch information
andrewnicols committed Apr 16, 2014
1 parent cc29e5d commit 234ead3
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
10 changes: 10 additions & 0 deletions lib/editor/atto/readme_moodle.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Description of the import of libraries associated with the Atto editor.

1) Rangy (version 1.2.3)
* Download the latest stable release;
* Copy the content of the 'currentrelease/uncompressed' folder into yui/src/rangy/js
* Run shifter against yui/src/rangy

Notes:
* We have patched 1.2.3 with a backport fix from the next release of Rangy which addresses an incompatibility
between Rangy and HTML5Shiv which is used in the bootstrapclean theme. See MDL-44798 for further information.
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ rangy.createModule("DomUtil", function(api, module) {
}

var workingNode = dom.getDocument(containerElement).createElement("span");
// Workaround for HTML5 Shiv's insane violation of document.createElement(). See Rangy issue 104 and HTML5
// Shiv issue 64: https://github.com/aFarkas/html5shiv/issues/64
if (workingNode.parentNode) {
workingNode.parentNode.removeChild(workingNode);
}
var comparison, workingComparisonType = isStart ? "StartToStart" : "StartToEnd";
var previousNode, nextNode, boundaryPosition, boundaryNode;

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ rangy.createModule("DomUtil", function(api, module) {
}

var workingNode = dom.getDocument(containerElement).createElement("span");
// Workaround for HTML5 Shiv's insane violation of document.createElement(). See Rangy issue 104 and HTML5
// Shiv issue 64: https://github.com/aFarkas/html5shiv/issues/64
if (workingNode.parentNode) {
workingNode.parentNode.removeChild(workingNode);
}
var comparison, workingComparisonType = isStart ? "StartToStart" : "StartToEnd";
var previousNode, nextNode, boundaryPosition, boundaryNode;

Expand Down
5 changes: 5 additions & 0 deletions lib/editor/atto/yui/src/rangy/js/rangy-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1937,6 +1937,11 @@ rangy.createModule("DomUtil", function(api, module) {
}

var workingNode = dom.getDocument(containerElement).createElement("span");
// Workaround for HTML5 Shiv's insane violation of document.createElement(). See Rangy issue 104 and HTML5
// Shiv issue 64: https://github.com/aFarkas/html5shiv/issues/64
if (workingNode.parentNode) {
workingNode.parentNode.removeChild(workingNode);
}
var comparison, workingComparisonType = isStart ? "StartToStart" : "StartToEnd";
var previousNode, nextNode, boundaryPosition, boundaryNode;

Expand Down

0 comments on commit 234ead3

Please sign in to comment.