use getAttribute to inspect document elements

el.getAttribute('attr') is more reliable than el[attr].
pull/1/head
ansuz 9 years ago
parent f5b0e1a5df
commit ec64e0d381

@ -36,7 +36,8 @@ define([
var isNotMagicLine = function (el) { var isNotMagicLine = function (el) {
// factor as: // factor as:
// return !(el.tagName === 'SPAN' && el.contentEditable === 'false'); // return !(el.tagName === 'SPAN' && el.contentEditable === 'false');
var filter = (el.tagName === 'SPAN' && el.contentEditable === 'false'); var filter = (el.tagName === 'SPAN' &&
el.getAttribute('contentEditable') === 'false');
if (filter) { if (filter) {
console.log("[hyperjson.serializer] prevented an element" + console.log("[hyperjson.serializer] prevented an element" +
"from being serialized:", el); "from being serialized:", el);
@ -97,7 +98,7 @@ define([
we should check when such an element is going to be we should check when such an element is going to be
removed, and prevent that from happening. */ removed, and prevent that from happening. */
if (info.node && info.node.tagName === 'SPAN' && if (info.node && info.node.tagName === 'SPAN' &&
info.node.contentEditable === "true") { info.node.getAttribute('contentEditable') === "false") {
// it seems to be a magicline plugin element... // it seems to be a magicline plugin element...
if (info.diff.action === 'removeElement') { if (info.diff.action === 'removeElement') {
// and you're about to remove it... // and you're about to remove it...

Loading…
Cancel
Save