edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] document.head.querySelector
@ 2017-12-10 10:02 Kevin Carhart
  2017-12-10 15:08 ` Karl Dahlke
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Carhart @ 2017-12-10 10:02 UTC (permalink / raw)
  To: edbrowse-dev



Sorry to write about multiple things concurrently, but I also hit this in 
the xqsuperschool code.  Interesting.. it's expecting document.head.querySelector so 
that it can query for metas by selector syntax.  I don't know why it needs 
to be called on document.head, when metas by definition will only 
be in head.

getConfig: function(name) {
var element;
element = document.head.querySelector("meta[name='action-cable-" + name + "']");
return element != null ? element.getAttribute("content") : void 0;
},

I have been banging my brains on it for a while.  Is there a proper place 
to add functions to document.head?  I tried adding it at the very bottom, after 
document.querySelector, and it wasn't recognizing document.head unless I 
am misinterpreting messages.

Does this need to take place after third.js has run?  No.. it doesn't, 
right?  Otherwise you wouldn't be able to define document.querySelector 
either.

thanks
Kevin


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Edbrowse-dev] document.head.querySelector
  2017-12-10 10:02 [Edbrowse-dev] document.head.querySelector Kevin Carhart
@ 2017-12-10 15:08 ` Karl Dahlke
  2017-12-11  9:27   ` Kevin Carhart
  0 siblings, 1 reply; 5+ messages in thread
From: Karl Dahlke @ 2017-12-10 15:08 UTC (permalink / raw)
  To: edbrowse-dev

Well it's true that document.head doesn't exist when startwindow runs, but Head does, so how bout

Head.prototype.querySelector = function(x) { return querySelectorAll(x)[0] }

Would something like that work?

Karl Dahlke

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Edbrowse-dev] document.head.querySelector
  2017-12-10 15:08 ` Karl Dahlke
@ 2017-12-11  9:27   ` Kevin Carhart
       [not found]     ` <20171111101510.eklhad@comcast.net>
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Carhart @ 2017-12-11  9:27 UTC (permalink / raw)
  To: edbrowse-dev



Thank you, Karl.  That worked great and it retrieved the meta it is trying 
to retrieve.  I have some bits and pieces I need to submit.  But here are 
a couple more questions:

- For the anchor element type, I think it needs a couple of the 
properties that we make use of on the URL class.   Would it be ok to add a couple of 
these things to case "a" like
case "a":
c = new Anchor();
c.protocol = "";
c.pathname = "";
break;

- xq wants document.createElementNS.  Does this ring a bell?  Maybe this 
would just be a wrapper to createElement which supplies the string 
"http://www.w3.org/1999/xhtml"

Is namespaces a real issue or just a nominal, placeholder issue?  It seems 
to me that it is just a nominal issue because MDN gives four valid 
namespace URIs, only one of which we would care about.  They are for HTML, 
SVG, XBL and XUL.  Who cares about the latter three?  We don't support 
them, so I don't think we would hit name collisions between them.

- I think there is something going on with cloneNode and whether cloneNode 
clones event handler code.  So that's an interesting problem.  Why now.. 
why not before now... I think maybe it's tested for in some versions of a 
library, like jquery, and maybe it wasn't previously.

thanks
Kevin



On Sun, 10 Dec 2017, Karl Dahlke wrote:

> Well it's true that document.head doesn't exist when startwindow runs, but Head does, so how bout
>
> Head.prototype.querySelector = function(x) { return querySelectorAll(x)[0] }
>
> Would something like that work?
>
> Karl Dahlke
> _______________________________________________
> Edbrowse-dev mailing list
> Edbrowse-dev@lists.the-brannons.com
> http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev
>

--------
Kevin Carhart * 415 225 5306 * The Ten Ninety Nihilists

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Edbrowse-dev] document.head.querySelector
       [not found]     ` <20171111101510.eklhad@comcast.net>
@ 2017-12-22  2:23       ` Kevin Carhart
  2017-12-22  2:58         ` Karl Dahlke
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Carhart @ 2017-12-22  2:23 UTC (permalink / raw)
  To: edbrowse-dev



I'm cleaning up my loose ends.  Sorry it took this long.  I'm going to 
send a startwindow with a few things including this from the 11th, where I 
can answer KD's latest followup from a week ago.  This is about element 
type "a":

> Does someone really ask for a.protocol?
> They should ask for a.href.protocol, I would think.
> Then maybe we should make a default href of type URL.
> But if they want a.protocol then there's no harm setting that to empty string I guess.

I don't know the thinking behind it, but if you demin the sole massive 
code file from xqsuperschool and go to 16343, that's my evidence that 
a.href and a.protocol is a thing.


         createWebSocketURL: function(url) {
           var a;
           if (url && !/^wss?:/i.test(url)) {
             a = document.createElement("a");
             a.href = url;
             a.href = a.href;
             a.protocol = a.protocol.replace("http", "ws");
             return a.href;
           } else {
             return url;
           }
         },











>
> Karl Dahlke
>

--------
Kevin Carhart * 415 225 5306 * The Ten Ninety Nihilists

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Edbrowse-dev] document.head.querySelector
  2017-12-22  2:23       ` Kevin Carhart
@ 2017-12-22  2:58         ` Karl Dahlke
  0 siblings, 0 replies; 5+ messages in thread
From: Karl Dahlke @ 2017-12-22  2:58 UTC (permalink / raw)
  To: edbrowse-dev

Well for starters, a.href = a.href; makes no sense to me.
What's the point of that?

Then my real question is, is a.protocol suppose to have side effects, not just a string.
Is it suppose to dip into a.href?

Object.defineProperty(A.prototype, "protocol", {
  get: function() {return this.href.protocol; },
  set: function(v) { this.href.protocol = v; }
});

If there are no such side effects then the code really doesn't make any sense.
You might have to dig into the behavior of the A tag to know for sure.

createWebSocketURL: function(url) {
var a;
if (url && !/^wss?:/i.test(url)) {
a = document.createElement("a");
a.href = url;
a.href = a.href;
a.protocol = a.protocol.replace("http", "ws");
return a.href;
} else {
return url;
}
},

Similar questions apply for img.src and iframe.src and form.action and other tags that have implicit urls.

Karl Dahlke

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-12-22  2:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-10 10:02 [Edbrowse-dev] document.head.querySelector Kevin Carhart
2017-12-10 15:08 ` Karl Dahlke
2017-12-11  9:27   ` Kevin Carhart
     [not found]     ` <20171111101510.eklhad@comcast.net>
2017-12-22  2:23       ` Kevin Carhart
2017-12-22  2:58         ` Karl Dahlke

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).