From 005a9da6b746b6191c1682b1c67f3a25cb2174a0 Mon Sep 17 00:00:00 2001 From: Marcin Koziej Date: Fri, 14 Dec 2012 10:27:09 +0100 Subject: [PATCH 1/1] String.startsWith not implemented in every browser, bummer. --- redakcja/static/js/wiki/view_editor_wysiwyg.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/redakcja/static/js/wiki/view_editor_wysiwyg.js b/redakcja/static/js/wiki/view_editor_wysiwyg.js index 7c0bb0e0..cb7c40f8 100644 --- a/redakcja/static/js/wiki/view_editor_wysiwyg.js +++ b/redakcja/static/js/wiki/view_editor_wysiwyg.js @@ -351,7 +351,7 @@ function getXNodeAttributes(node) { var m = {} $.map(node.attributes, function(attrNode) { - if (attrNode.nodeName.startsWith('data-wlf-')) { + if (attrNode.nodeName.indexOf('data-wlf-') === 0) { var n = attrNode.nodeName.substr(9); var v = attrNode.nodeValue; m[n] = v; @@ -363,11 +363,11 @@ function setXNodeAttributes(node, attrs) { $.map(node.attributes, function(attrNode) { var xName = attrNode.nodeName.substr(9); - if (attrNode.nodeName.startsWith('data-wlf-') + if (attrNode.nodeName.indexOf('data-wlf-') === 0 && xName in attrs) { attrNode.nodeValue = attrs[xName]; } - if (attrNode.nodeName.startsWith('x-attr-name-') + if (attrNode.nodeName.indexOf('x-attr-name-') === 0 && attrNode.nodeValue in attrs) { node.setAttribute('x-attr-value-' + attrNode.nodeName.substr("x-attr-name-".length), attrs[attrNode.nodeValue]); -- 2.20.1