The default bug view has changed. See this FAQ.

Support IE extension Event.srcElement




DOM: Events
9 years ago
25 days ago


(Reporter: henryfhchan, Unassigned)


(Blocks: 1 bug, {dev-doc-needed})

Dependency tree / graph

Firefox Tracking Flags

(Not tracked)


(Whiteboard: [parity-chrome][parity-safari][parity-ie][parity-edge][plaform-rel-Edge][platform-rel-Microsoft], URL)


(2 attachments)



9 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b1pre) Gecko/20080903034741 Minefield/3.1b1pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b1pre) Gecko/20080903034741 Minefield/3.1b1pre

Since firefox already has an added undetectable document.all method, and has had detectable clientWidth clientHeight offsetWidth offsetHeight scrollWidth scrollHeight offsetLeft offsetRight scrollLeft scrollRight (just to name a few properties), why not add more undetectable Proprietary methods/properties?

The escape, find, atob, btab are other methods not found in w3c either.

Reproducible: Always

event.srcElement should just map directly to (I find no problems and no difference in my scripts in IE and Fx if I just swap them over.)
Component: General → DOM: Events
Product: Firefox → Core
QA Contact: general → events

Comment 1

9 years ago
IE's event model is so different comparing to DOM Events that I don't see
real reason to support srcElement. (And IIRC, IE will support DOM Events at some point)
We implemented document.all (which was a major pain, btw) because it was a big compat win.  I don't see that doing srcElement will be nearly as big a win, but perhaps you have data to the contrary?
Blocks: 752800

Comment 3

5 years ago
Not sure if this helps, but on a whim I today went through my dataset of 1m HTML/JS/CSS urls from the top 25,000 websites on the web, all collected recently using the latest Fennec UA. They were crawled by visiting the home page of each domain and each page in the same domain linked from the home page (ie one level deep).

1,580 of the domains had some Javascript that include the string "event.srcElement".

Comment 4

5 years ago
Note, IE9 supports DOM Events, so there shouldn't be need for this.

Comment 5

5 years ago
Note: Chrome, Safari, and Opera all support srcElement now.


5 years ago
Blocks: 771949

Comment 6

5 years ago
Created attachment 643135 [details]
List of 4910 JS and HTML URLs from 900 domains that have e.srcElement but no reference

Please find attached a list of 4910 HTML and Javascript URLs from 900 of the top 18,000 sites on the web that make reference to .srcElement without a nearby reference to .target, implying that the latter is not present. While I can't say for certain that the evidence for each site is 100% conclusive, I can say that I've hand-checked a decent random sample of them.

Comment 7

5 years ago
(In reply to John Jensen from comment #6)
> I can say that I've hand-checked a decent random sample of them.
Meaning what? You've checked that the site doesn't work with FF?

Comment 8

5 years ago
(In reply to Olli Pettay [:smaug] from comment #7)

> Meaning what? You've checked that the site doesn't work with FF?

 a) there isn't a DOM reference in same portion of JS code to both .srcElement and .target, and
 b) in most cases, that the related functionality doesn't work in Firefox. (In some cases I wasn't able to because my JS knowledge is not good enough to figure out what it was trying to do).

I should add that all data was collected using a very recent Fennec UA (v12 or 13).

Comment 9

5 years ago
Sounds like some very odd mobile-only problem.
It would be sad if we had to add more IE-ism, when IE has itself moved to DOM Events.
There is no specification for srcElement, so we should probably just look at webkit source code
and copy their behavior and hope the best.
But, I'm still against adding srcElement.

(Btw, the original comment mentions few properties and all those are specified in some spec.)
John, have you tried passing some webkit UA string?

Comment 11

5 years ago
> John, have you tried passing some webkit UA string?

I have a very similar datasets, collected with either the iPhone or stock Android UAs. I can rerun the effort, although my experience with a number of similar issues regarding CSS and UAs tells me the results will not be that different.
I'd really rather not support another undetectable property. We should definitely look at WebKit and look at what their implementation does. If it simply maps .srcElement to .target then it doesn't seem like a big deal to support.

It's not very surprising that a few "IE-isms" have taken foot hold in the mobile space given how prevalent webkit is there, and how many "IE-isms" are also "webkit-isms". I.e. given how many features webkit has copied from IE.
If we add srcElement, maybe we also need to support window.event. I don't think those sites consider the possibility that window.event is absent.
And we should propose to spec srcElement instead of imposing reverse-engineering on all implementers.
srcElement does return the same thing as target in WebKit:

I filed
Summary: Supporting of IE only property srcelement of event but as undetectable property → Support IE extension Event.srcElement


11 months ago
Chrome usage shows this at 9.8%: (but I suspect they're hitting code like `target = event.srcElement ||`.

Some related srcElement bugs (some fixed by evangelism): mentions have busted icons due to srcElement

ni? myself to dig thru our bugs and see how much pain is caused on the window.event side of things (my gut feeling is it's much more than srcElement).
Flags: needinfo?(miket)


11 months ago
Flags: needinfo?(miket)
See Also: → bug 218415


10 months ago
OS: Windows XP → All
Hardware: x86 → All
Whiteboard: [parity-chrome][parity-safari][parity-ie]
Version: unspecified → Trunk
Keywords: dev-doc-needed
Microsoft's "Global CSS Property Usage" dashboard is broken on Firefox because the page uses Event#srcElement.

2) Enter some text in the "Filter properties" field, such as "font".

Expected Behavior:
The list of CSS properties should only show the "font" names. This works correctly in Chrome, Safari, and (unsurprisingly) IE11 and Edge.

Actual Behavior:
Nothing happens on the page. The following JavaScript error is logged to the console:

TypeError: a.srcElement is undefined. usage.4e36d87.js:15:48

which points to the following code in

// As the user types (or clicks the Clear button), perform filtering
i.addEventListener("input",function(a){k(),l(),m(a.srcElement.value)}),n(),window.addEventListener("popstate",n)}}(),/* eslint "strict": [2, "function"] */
Whiteboard: [parity-chrome][parity-safari][parity-ie] → [parity-chrome][parity-safari][parity-ie][parity-edge]
platform-rel: --- → ?
Whiteboard: [parity-chrome][parity-safari][parity-ie][parity-edge] → [parity-chrome][parity-safari][parity-ie][parity-edge][plaform-rel-Chrome][platform-rel-Microsoft]
Whiteboard: [parity-chrome][parity-safari][parity-ie][parity-edge][plaform-rel-Chrome][platform-rel-Microsoft] → [parity-chrome][parity-safari][parity-ie][parity-edge][plaform-rel-Edge][platform-rel-Microsoft]
Comment hidden (obsolete)

Comment 19

8 months ago
Sorry for closing quickly I thought it was in Tech Evangelism. :)
The issue reported in Comment #17 is fixed.
Ever confirmed: true
Resolution: FIXED → ---
platform-rel: ? → ---
Created attachment 8834986 [details]

My ASUS router is complaining about this too.
Blocks: 1339000
(In reply to Mike Taylor [:miketaylr] from comment #20)
> Created attachment 8834986 [details]
> srcElement-asus.png
> My ASUS router is complaining about this too.

I like that your search term was "asus router ip" :)
You need to log in before you can comment on or make changes to this bug.