edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] [PATCH] nasa: tidy options, Option.prototype and document.metas
@ 2017-02-01  0:25 Kevin Carhart
  0 siblings, 0 replies; only message in thread
From: Kevin Carhart @ 2017-02-01  0:25 UTC (permalink / raw)
  To: Edbrowse-dev

>From 1cbb29e4f29f74e81376dab4e8eca0e7bcc6849c Mon Sep 17 00:00:00 2001
From: Kevin Carhart <kevin@carhart.net>
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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-02-01  0:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-01  0:25 [Edbrowse-dev] [PATCH] nasa: tidy options, Option.prototype and document.metas Kevin Carhart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).