Unverified Commit ae6c696c authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #794 from hypothesis/use-node-iterator-polyfill

Add missing polyfill for IE 11 compatibility when annotating PDFs
parents 259a52db 6840d0e8
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
"dom-anchor-fragment": "^1.0.1", "dom-anchor-fragment": "^1.0.1",
"dom-anchor-text-position": "^4.0.0", "dom-anchor-text-position": "^4.0.0",
"dom-anchor-text-quote": "^4.0.2", "dom-anchor-text-quote": "^4.0.2",
"dom-node-iterator": "^3.5.3",
"dom-seek": "^4.0.3", "dom-seek": "^4.0.3",
"end-of-stream": "^1.1.0", "end-of-stream": "^1.1.0",
"escape-html": "^1.0.3", "escape-html": "^1.0.3",
......
seek = require('dom-seek') seek = require('dom-seek')
# `dom-node-iterator` polyfills optional arguments of `createNodeIterator`
# and properties of the returned `NodeIterator` for IE 11 compatibility.
createNodeIterator = require('dom-node-iterator/polyfill')()
xpathRange = require('./range') xpathRange = require('./range')
html = require('./html') html = require('./html')
...@@ -285,9 +288,7 @@ exports.describe = (root, range, options = {}) -> ...@@ -285,9 +288,7 @@ exports.describe = (root, range, options = {}) ->
startPageIndex = getSiblingIndex(startTextLayer.parentNode) startPageIndex = getSiblingIndex(startTextLayer.parentNode)
endPageIndex = getSiblingIndex(endTextLayer.parentNode) endPageIndex = getSiblingIndex(endTextLayer.parentNode)
# The `whatToShow`, `filter` and `expandEntityReferences` arguments are iter = createNodeIterator.call(document, startTextLayer, NodeFilter.SHOW_TEXT)
# mandatory in IE although optional according to the spec.
iter = document.createNodeIterator(startTextLayer, NodeFilter.SHOW_TEXT, null, false);
start = seek(iter, range.start) start = seek(iter, range.start)
end = seek(iter, range.end) + start + range.end.textContent.length end = seek(iter, range.end) + start + range.end.textContent.length
......
...@@ -2416,7 +2416,7 @@ dom-anchor-text-quote@^4.0.2: ...@@ -2416,7 +2416,7 @@ dom-anchor-text-quote@^4.0.2:
diff-match-patch "^1.0.0" diff-match-patch "^1.0.0"
dom-anchor-text-position "^4.0.0" dom-anchor-text-position "^4.0.0"
dom-node-iterator@^3.5.0: dom-node-iterator@^3.5.0, dom-node-iterator@^3.5.3:
version "3.5.3" version "3.5.3"
resolved "https://registry.yarnpkg.com/dom-node-iterator/-/dom-node-iterator-3.5.3.tgz#32b68aa440962f1734487029f544a3db704637b7" resolved "https://registry.yarnpkg.com/dom-node-iterator/-/dom-node-iterator-3.5.3.tgz#32b68aa440962f1734487029f544a3db704637b7"
integrity sha1-MraKpECWLxc0SHAp9USj23BGN7c= integrity sha1-MraKpECWLxc0SHAp9USj23BGN7c=
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment