From 83c9180d0b69e6df35c97890392b61459a568dd3 Mon Sep 17 00:00:00 2001 From: Johannes Raggam Date: Mon, 7 Dec 2020 22:43:54 +0100 Subject: [PATCH] start rebasing options until i recognized that a un-parse/serialize to attributes method is missing from the parser --- src/pat/inject/inject.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/pat/inject/inject.js b/src/pat/inject/inject.js index e2ba97a99..0d3bb47f3 100644 --- a/src/pat/inject/inject.js +++ b/src/pat/inject/inject.js @@ -907,6 +907,14 @@ const inject = { VIDEO: "data-pat-inject-rebase-src", }, + _rebaseOptions: { + ".pat-inject": "url", + ".pat-calendar": "url", + ".pat-date-picker": "i18n", + ".pat-datetime-picker": "i18n", + ".pat-collapsible": "load-content", + }, + _rebaseHTML: function inject_rebaseHTML(base, html) { if (html === "") { // Special case, source is none @@ -941,6 +949,18 @@ const inject = { $this.attr(attrName, value); } }); + + const rebase_options = $page[0].querySelectorAll( + Object.keys(inject._rebaseOptions).join(",") + ); + for (const el of rebase_options) { + for (const attr of Object.values(inject._rebaseOptions)) { + const opt = el.getAttribute(attr, null); + if (opt) { + } + } + } + // XXX: IE8 changes the order of attributes in html. The following // lines move data-pat-inject-rebase-src to src. $page.find("[data-pat-inject-rebase-src]").each(function () {