Merge pull request #1159 from kronion/issue-956-fix-m.trust-offsets

Patch for #956: redraw trusted content with multiple nodes
This commit is contained in:
Isiah Meadows 2016-07-23 08:47:35 -04:00 committed by GitHub
commit 72b6c1e68d
2 changed files with 34 additions and 4 deletions

View file

@ -538,6 +538,7 @@
}
cached = new data.constructor(data)
cached.nodes = nodes
cached.$trusted = data.$trusted
return cached
}
@ -564,10 +565,7 @@
if (item.$trusted) {
// fix offset of next element if item was a trusted string w/ more
// than one html element
// the first clause in the regexp matches elements
// the second clause (after the pipe) matches text nodes
var match = item.match(/<[^\/]|\>\s*[^<]/g)
if (match != null) return match.length
return item.nodes.length
} else if (isArray(item)) {
return item.length
}