scribe-editor
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -0,1 +1,5 @@ | ||
# 1.2.4 | ||
Changes the way that root nodes are detected, the code now uses the element that the Scribe instance is bound to rather than looking for contenteditable attributes. | ||
# 1.2.3 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "scribe-editor", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"main": "src/scribe.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -12,6 +12,5 @@ define(function () { | ||
// TODO: write tests. unit or integration? | ||
Node.prototype.getAncestor = function (nodeFilter) { | ||
Node.prototype.getAncestor = function (rootElement, nodeFilter) { | ||
var isTopContainerElement = function (element) { | ||
return element && element.attributes | ||
&& element.attributes.getNamedItem('contenteditable'); | ||
return rootElement === element; | ||
}; | ||
@@ -18,0 +17,0 @@ // TODO: should this happen here? |
@@ -28,6 +28,5 @@ define([ | ||
var node = new scribe.api.Node(this.range.commonAncestorContainer); | ||
var isTopContainerElement = node.node && node.node.attributes | ||
&& node.node.attributes.getNamedItem('contenteditable'); | ||
var isTopContainerElement = node.node && scribe.el === node.node; | ||
return ! isTopContainerElement && nodeFilter(node.node) ? node.node : node.getAncestor(nodeFilter); | ||
return ! isTopContainerElement && nodeFilter(node.node) ? node.node : node.getAncestor(scribe.el, nodeFilter); | ||
}; | ||
@@ -34,0 +33,0 @@ |
179902
3785