From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out.smtp-auth.no-ip.com (out.smtp-auth.no-ip.com [8.23.224.60]) by hurricane.the-brannons.com (Postfix) with ESMTPS id 2512777AA6 for ; Tue, 31 Jan 2017 16:24:20 -0800 (PST) X-No-IP: carhart.net@noip-smtp X-Report-Spam-To: abuse@no-ip.com Received: from carhart.net (unknown [99.52.200.227]) (Authenticated sender: carhart.net@noip-smtp) by smtp-auth.no-ip.com (Postfix) with ESMTPA id 2AA5C23B for ; Tue, 31 Jan 2017 16:25:13 -0800 (PST) Received: from kevc (carhart.net [192.168.1.179]) by carhart.net (8.13.8/8.13.8) with ESMTP id v110PC3Z014270; Tue, 31 Jan 2017 16:25:12 -0800 To: Edbrowse-dev@lists.the-brannons.com From: Kevin Carhart Reply-to: Kevin Carhart User-Agent: edbrowse/3.5.4.2 Date: Tue, 31 Jan 2017 16:25:12 -0800 Message-ID: <20170031162512.kevin@carhart.net > Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Subject: [Edbrowse-dev] [PATCH] nasa: tidy options, Option.prototype and document.metas X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.23 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2017 00:24:20 -0000 >>From 1cbb29e4f29f74e81376dab4e8eca0e7bcc6849c Mon Sep 17 00:00:00 2001 From: Kevin Carhart Date: Tue, 31 Jan 2017 16:15:22 -0800 Subject: [PATCH] three problems exemplified by nasa.gov. (1) Tidy options that will flesh out a piece of DOM even when there is nothing in it (2) prototype section for Option (3) pass the meta tags to the JS side so that they will be in document.head.childNodes and their content can be read by page JS --- src/decorate.c | 7 +++++++ src/html-tidy.c | 2 ++ src/startwindow.js | 27 +++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/decorate.c b/src/decorate.c index be77151..19220a5 100644 --- a/src/decorate.c +++ b/src/decorate.c @@ -1091,6 +1091,13 @@ static void jsNode(struct htmlTag *t, bool opentag) } break; + case TAGACT_META: + domLink(t, "Meta", "content", "metas", cw->docobj, 0); + a = attribVal(t, "content"); + set_property_string(t->jv, "content", a); + set_property_number(t->jv, "nodeType", 1); + break; + case TAGACT_SCRIPT: domLink(t, "Script", "src", "scripts", cw->docobj, 0); a = attribVal(t, "type"); diff --git a/src/html-tidy.c b/src/html-tidy.c index d121c21..5ba3fdb 100644 --- a/src/html-tidy.c +++ b/src/html-tidy.c @@ -123,6 +123,8 @@ void html2nodes(const char *htmltext, bool startpage) // the following tidyOptSetBool implements // a fix for https://github.com/htacg/tidy-html5/issues/348 tidyOptSetBool( tdoc, TidyEscapeScripts, no ); + tidyOptSetBool( tdoc, TidyDropEmptyElems, no ); + tidyOptSetBool( tdoc, TidyDropEmptyParas, no ); tidySetCharEncoding(tdoc, (cons_utf8 ? "utf8" : "latin1")); diff --git a/src/startwindow.js b/src/startwindow.js index 6c9420d..814778a 100644 --- a/src/startwindow.js +++ b/src/startwindow.js @@ -1382,6 +1382,33 @@ Frame.prototype.cloneNode = document.cloneNode; Frame.prototype.hasAttribute = document.hasAttribute; Frame.prototype.removeAttribute = document.removeAttribute; +Option.prototype.appendChild = document.appendChild; +Option.prototype.apch1$ = document.apch1$; +Option.prototype.apch2$ = document.apch2$; +Option.prototype.getAttribute = document.getAttribute; +Option.prototype.setAttribute = document.setAttribute; +Option.prototype.insertBefore = document.insertBefore; +Option.prototype.insbf$ = document.insbf$; +Object.defineProperty(Option.prototype, "firstChild", { +get: function() { return this.childNodes[0]; } +}); +Object.defineProperty(Option.prototype, "lastChild", { +get: function() { return this.childNodes[this.childNodes.length-1]; } +}); +Object.defineProperty(Option.prototype, "nextSibling", { +get: function() { return get_sibling(this,"next"); } +}); +Object.defineProperty(Option.prototype, "previousSibling", { +get: function() { return get_sibling(this,"previous"); } +}); + +Option.prototype.hasChildNodes = document.hasChildNodes; +Option.prototype.removeChild = document.removeChild; +Option.prototype.replaceChild = document.replaceChild; +Option.prototype.cloneNode = document.cloneNode; +Option.prototype.hasAttribute = document.hasAttribute; +Option.prototype.removeAttribute = document.removeAttribute; + /* navigator; some parameters are filled in by the buildstartwindow script. */ navigator.appName = "edbrowse"; navigator["appCode Name"] = "edbrowse C/mozjs"; -- 1.8.3.2