You are not logged in.

#1 2012-11-28 20:30:01

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

[Solved] bbs.archlinux.org addEventListener bug?

I'm trying to add a javascript eventlistener to the bbs, for some reason this works fine in Firefox but not in Chromium. I did some additional testing and am getting strange results. Here's the test:

document.body.addEventListener('keydown', function() { console.log('1'); }, false);

[Firefox: OK] https://bbs.archlinux.org
[Firefox: OK] http://slashdot.org
[Firefox: OK] https://www.paypal.com

[Chromium: FAIL] https://bbs.archlinux.org
[Chromium: OK] http://slashdot.org 
[Chromium: OK] https://www.paypal.com

FAIL means that the event didn't attach and/or fire.

The results were confirmed by another tester, but does anyone have any idea what could cause this?

It could be a Chromium bug, but i really wonder why only the bbs is affected...

Last edited by litemotiv (2012-11-28 22:30:31)


ᶘ ᵒᴥᵒᶅ

Offline

#2 2012-11-28 21:53:28

livibetter
Member
From: Taipei
Registered: 2008-05-14
Posts: 95
Website

Re: [Solved] bbs.archlinux.org addEventListener bug?

I think it has something to do with

application/xhtml+xml

After I tried to use an almost empty local html file to test, the event fired, I noticed the return MIME type from server, so I tried to find another page to test and found this page, the server returns the same MIME not text/html. And the event will not fire, either. I do not actually read the page, but one line caught my eyes:

document.body deprecated in favour of document.documentElement

Not sure if it has something to do with this issue. Strangely, if you use mouse event, e.g. click, the event will fire.

I've tried to attach the event on `document` and `document.documentElement` the keyboard event will fire.

Last edited by livibetter (2012-11-28 21:54:12)

Offline

#3 2012-11-28 22:08:45

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] bbs.archlinux.org addEventListener bug?

Excellent detective work livibetter, that's definitely the cause. smile


ᶘ ᵒᴥᵒᶅ

Offline

#4 2012-11-28 22:15:49

livibetter
Member
From: Taipei
Registered: 2008-05-14
Posts: 95
Website

Re: [Solved] bbs.archlinux.org addEventListener bug?

Just curious, are you working on some user script or something new feature would be on forums?

Last edited by livibetter (2012-11-28 22:16:05)

Offline

#5 2012-11-28 22:30:16

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] bbs.archlinux.org addEventListener bug?

No actually i was debugging the Type-ahead-find Chromium extension which stopped working on the Arch bbs. Nothing really exciting i'm afraid...


ᶘ ᵒᴥᵒᶅ

Offline

#6 2012-11-30 18:43:35

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] bbs.archlinux.org addEventListener bug?

I was wondering why some of Vimprobable's keyboard functions had stopped working on the bbs (most annoyingly, the ability to open a text field in Vim); this seems to be the reason.


#edit: litemotiv, have you filed a bug report?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#7 2012-11-30 19:47:40

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] bbs.archlinux.org addEventListener bug?

jasonwryan wrote:

I was wondering why some of Vimprobable's keyboard functions had stopped working on the bbs (most annoyingly, the ability to open a text field in Vim); this seems to be the reason.

#edit: litemotiv, have you filed a bug report?

I did file a bugreport for Type-ahead-find, since technically this is a client bug.

XHTML is only parsed as a real XML document when the MIME type is set to application/xhtml+xml by the server. When that is the case, you run into the situation that document.body is not officially supported in XML, in favor of document.documentElement. So when using documentElement (or as livibetter found out possibly just 'document') instead, everything works as intended.

I copied an Arch bbs page to another server and the script worked fine there. probably because the other server didn't set the correct MIME and sent it as regular text/html. As such it wasn't a proper XML document and document.body was faux-supported.

Maybe XHTML got enforced more strictly recently in a Webkit update, that would explain why it used to work in both Chromium and other derivates like Vimprobable. If the latter relies on the same deprecated method of event attachment, then it should be reported as a bug there.


ᶘ ᵒᴥᵒᶅ

Offline

#8 2012-11-30 20:14:03

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] bbs.archlinux.org addEventListener bug?

litemotiv wrote:

Maybe XHTML got enforced more strictly recently in a Webkit update, that would explain why it used to work in both Chromium and other derivates like Vimprobable. If the latter relies on the same deprecated method of event attachment, then it should be reported as a bug there.

That makes sense: thanks lite!


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB