* possible root cause in gebcn for a recaptcha issue
@ 2021-10-20 10:31 Kevin Carhart
2021-10-20 11:33 ` Karl Dahlke
2021-10-20 12:00 ` root element Karl Dahlke
0 siblings, 2 replies; 5+ messages in thread
From: Kevin Carhart @ 2021-10-20 10:31 UTC (permalink / raw)
To: edbrowse-dev
I may have found the root cause for the current issue with recaptcha/paypal
Sending to list so that I can include a block of innerHTML
In this sample session, I create a div, then make sure the childNodes are ready, and then echo the class for two of them. After that, I try to pick them up with getElementsByClassName. It seems like we return an element on "recaptcha-checkbox-border" but we don't return an element on ""recaptcha-checkbox-borderAnimation". Could there be a case issue?
Barring something I'm missing of course.
K
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test1 = document.createElement("DIV")
[object Object]
test1.innerHTML = '<SPAN class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox" id="recaptcha-anchor"></SPAN><DIV class="recaptcha-checkbox-border"><SPAN class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox" id="recaptcha-anchor"></SPAN></DIV><DIV class="recaptcha-checkbox-borderAnimation"><SPAN class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox" id="recaptcha-anchor"></SPAN></DIV><DIV class="recaptcha-checkbox-spinner"><SPAN class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox" id="recaptcha-anchor"></SPAN><DIV class="recaptcha-checkbox-spinner-overlay"><SPAN class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox" id="recaptcha-anchor"></SPAN></DIV></DIV><DIV class="recaptcha-checkbox-checkmark"><SPAN class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox" id="recaptcha-anchor"></SPAN></DIV>'
[...]
.
bye
jdb
cx2 jsrt.browse
test1
[object Object]
ok(test1)
childNodes,parentNode,tagName,nodeName,nodeType,class,ownerDocument,innerHTML,inner$HTML,name,id
test1.childNodes
[object Object],[object Object],[object Object],[object Object],[object Object]
test1.childNodes[0].class
recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox
test1.childNodes[1].class
recaptcha-checkbox-border
test1.childNodes[2].class
recaptcha-checkbox-borderAnimation
test2 = test1.getElementsByClassName("recaptcha-checkbox-border")
[object Object]
test3 = test1.getElementsByClassName("recaptcha-checkbox-borderAnimation")
^ permalink raw reply [flat|nested] 5+ messages in thread
* possible root cause in gebcn for a recaptcha issue
2021-10-20 10:31 possible root cause in gebcn for a recaptcha issue Kevin Carhart
@ 2021-10-20 11:33 ` Karl Dahlke
2021-10-20 12:31 ` Kevin Carhart
2021-10-20 12:00 ` root element Karl Dahlke
1 sibling, 1 reply; 5+ messages in thread
From: Karl Dahlke @ 2021-10-20 11:33 UTC (permalink / raw)
To: edbrowse-dev
[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]
Quoting Robin Williams .... "Well I feel sheepish."
I was sure those methods were case insensitive, and wrote them that way, and at least one is, getElementsByTagName, which is probably how it got into my head.
But ClassName is case sensitive.
Just a couple lines to fix, and sorry you had to invest so much time to find it.
Ugh!
I also had it wrong as I thought it was a disjunction, it is a conjunction.
It helps to read, and reread, the documentation I guess.
I tested with jsrt, acid3, and nasa, all still stand.
Also with your example, which works now.
Here's a funny thing about nasa, one of my earlier commits causes more of the site to appear, that is, you don't have to type showall any more to get all of the links.
That's one of those fixes here has lateral benefits there.
Here's something not so funny.
At least one of those Elements methods returns a live array.
You see this now and then, a live array, edbrowse doesn't implement a live array, and I wouldn't even know how to do it!
Some day we might have to deal with this.
I'm actually surprised it isn't tested anywhere in acid3.
I'm giving you this heads up, so you can watch for it while testing.
I've never seen code in the wild use the properties of a live array, I wouldn't if I were writing js, it's an unpredictable pain in the ass!
Ugh!
Karl Dahlke
^ permalink raw reply [flat|nested] 5+ messages in thread
* root element
2021-10-20 10:31 possible root cause in gebcn for a recaptcha issue Kevin Carhart
2021-10-20 11:33 ` Karl Dahlke
@ 2021-10-20 12:00 ` Karl Dahlke
1 sibling, 0 replies; 5+ messages in thread
From: Karl Dahlke @ 2021-10-20 12:00 UTC (permalink / raw)
To: edbrowse-dev
Speaking of getElementsByClassName, here's something I didn't quite get from the documentation.
Is the root node included or not?
And for any or all of the Elements methods.
This example is for Class, but you know what I mean.
We want to get this right so poor Kevin doesn't have to spend a week tracking it down.
Here is an example and note the inconsistency.
I do remember reading docs about querySelectorAll so I'm pretty sure that one is right.
test1=document.createElement("div"),test2=document.createElement("div"),test1.appendChild(test2);
test1.classList.add("snork"),test2.classList.add("snork")
test1.getElementsByClassName("snork").length
test1.querySelectorAll(".snork").length
Karl Dahlke
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: possible root cause in gebcn for a recaptcha issue
2021-10-20 11:33 ` Karl Dahlke
@ 2021-10-20 12:31 ` Kevin Carhart
2021-10-20 12:59 ` Karl Dahlke
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Carhart @ 2021-10-20 12:31 UTC (permalink / raw)
To: Karl Dahlke, edbrowse-dev
Don't worry, I knew what I was signing up for in hacking a JS library written by Google.
I have read about the live arrays. So the result set is supposed to always be up to date at request time? Could this be done with a getter/setter concept? It only needs to be live Just In Time.
^ permalink raw reply [flat|nested] 5+ messages in thread
* possible root cause in gebcn for a recaptcha issue
2021-10-20 12:31 ` Kevin Carhart
@ 2021-10-20 12:59 ` Karl Dahlke
0 siblings, 0 replies; 5+ messages in thread
From: Karl Dahlke @ 2021-10-20 12:59 UTC (permalink / raw)
To: edbrowse-dev
> Could this be done with a getter/setter concept?
Not directly.
getter is on the property of an object, not a single variable.
foo.bar invokes a getter every time you reference it, but if you just say
x = blah
x is no longer a getter, it might be the result of a getter but it is what it is.
Indirectly, imagine x being an object with getters on the object, lots of them.
Like all the array methods, they first populate x, according to its original call,
then invoke the array method.
That's fine but what about the simple
x[3]
Am I supppose to put a getter on 3, to repopulate the list and make sure I'm returning item 3?
Should I do that for every possible integer?
That's not practical!
So as I say, I don't know how to do it.
Karl Dahlke
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-10-20 12:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 10:31 possible root cause in gebcn for a recaptcha issue Kevin Carhart
2021-10-20 11:33 ` Karl Dahlke
2021-10-20 12:31 ` Kevin Carhart
2021-10-20 12:59 ` Karl Dahlke
2021-10-20 12:00 ` root element 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).