From 565fb1d186d3946cbfada712fc26fcc516b040b1 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 21 Apr 2016 15:40:29 +0200 Subject: [PATCH] include small snippets for preventing browser fights --- www/p/main.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/www/p/main.js b/www/p/main.js index b2306aff2..89b6bef8c 100644 --- a/www/p/main.js +++ b/www/p/main.js @@ -60,6 +60,20 @@ define([ return hj; }; + /* TODO integrate into flow to prevent browser fights over style */ + var setStyle = function (elem, newStyleAttr) { + elem.setAttribute("data-chainpad-origstyle", newStyleAttr); + elem.setAttribute("style", newStyleAttr); + elem.setAttribute("data-chainpad-styleclone", elem.getAttribute("style")); + }; + + /* TODO integrate into flow to prevent browser fights over style */ + var getStyle = function (elem) { + var st = elem.getAttribute("style"); + if (elem.getAttribute("data-chainpad-styleclone") !== st) { return st; } + return elem.getAttribute("data-chainpad-origstyle"); + }; + var stringifyDOM = module.stringifyDOM = function (dom) { return stringify(Hyperjson.fromDOM(dom, isNotMagicLine, brFilter)); };