From: Kevin Carhart <kevin@carhart.net>
To: Edbrowse-dev@lists.the-brannons.com
Subject: [Edbrowse-dev] [PATCH] nasa: tidy options, Option.prototype and document.metas
Date: Tue, 31 Jan 2017 16:25:12 -0800 [thread overview]
Message-ID: <20170031162512.kevin@carhart.net > (raw)
>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
reply other threads:[~2017-02-01 0:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='20170031162512.kevin@carhart.net ' \
--to=kevin@carhart.net \
--cc=Edbrowse-dev@lists.the-brannons.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).