Prev: FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type? (2010-06-27)
Next: JägerMonkey Was: The strange story of ! and ==(=)false
From: Thomas 'PointedEars' Lahn on 27 Jun 2010 05:16 Ciaran wrote: > Ry Nohryb wrote: >> Scott Sauyet wrote: >> > Thomas 'PointedEars' Lahn wrote: >> > > Scott Sauyet wrote: >> > >> I'm curious as to this. The original question was >> > >> >> > >> | Is it possible to trigger the hover state of an element using >> > >> | javascript? >> > >> [ ... ] >> > >> Are you suggesting that there are circumstances where this can >> > >> be done? If so, could you elaborate? >> > > >> > > In W3C DOM Level 2+ Events-compliant implementations you can create >> > > and dispatch events programmatically. If you create a `mouseover' >> > > event and dispatch it to an element object, it should trigger >> > > whatever "hover state" is supposed to mean of the corresponding >> > > element. >> > > >> > > Cf. <https://developer.mozilla.org/en/DOM/document.createEvent> >> > >> > Thank you. I had never really looked at that before. It's a shame >> > that this is not implemented universally. >> >> I think it's been implemented in most browsers for a few years now. >> But there's something very important to watch out with events emitted >> in this way: they are handled *synchronously*, they are not queued as >> events usually are, Rubbish. Events are _not_ queued; they are created and dispatched. >> they are instead handled from within the call to dispatchEvent(): Because the event is dispatched *manually* (here: immediately after creation). >> (function () { >> var evt = document.createEvent("MouseEvents"); >> evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, >> false, false, false, false, 0, null); >> var ctr= 0; >> document.body.onclick= function () { ctr++; }; >> document.body.dispatchEvent(evt); >> console.log(ctr); >> setTimeout(function(){ console.log(ctr); }); You forgot `window.' and the mandatory second argument in the last statement, but your example would not prove your argument even if you didn't. >> })(); >> >> --> 1, 1 > > Thanks Jorge. For what? Posting nonsense again, while *I* have provided the correct reference? > I can't understand why 'PointedEars' did not mention any > of this interesting detail in his initial reply on this thread, > or in even afterwards when I probed further I did on both accounts. And this is not a support forum, so nothing for you to probe, but a lot for you to learn. Learn to read and to ask smart questions to begin with. <http://www.catb.org/~esr/faqs/smart-questions.html> Score adjusted PointedEars -- Anyone who slaps a 'this page is best viewed with Browser X' label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network. -- Tim Berners-Lee
From: Ry Nohryb on 27 Jun 2010 17:55 On Jun 27, 11:16 am, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote: > > Ry Nohryb wrote: > >> But there's something very important to watch out with events emitted > >> in this way: they are handled *synchronously*, they are not queued as > >> events usually are, > > Rubbish. Events are _not_ queued; Yes Pointy, most if not all of the user interface events (click, scroll, mousemove, etc) are queued, DOM mutation events aren't queued: they're handled synchronously, as is the first onreadystatechange event that gets triggered by an xhr.send(), and the events handed to .dispatchEvent(event). -- Jorge.
From: Dr J R Stockton on 28 Jun 2010 13:58 In comp.lang.javascript message <9203324.ljVUCQOuko(a)PointedEars.de>, Sun, 27 Jun 2010 11:16:59, Thomas 'PointedEars' Lahn <PointedEars(a)web.de> posted: > And this is not a support forum, so nothing for >you to probe, but a lot for you to learn. Learn to read and to ask smart >questions to begin with. <FAQENTRY> An entry on Pointy-Head is needed, to explain the peculiar nature of his personality and the general invalidity of such of his opinions as are not traceable to ECMA-262. -- (c) John Stockton, nr London UK. ??@merlyn.demon.co.uk Turnpike v6.05 MIME. Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links. In MS OE, choose Tools, Options, Send; select Plain Text for News and E-mail. Don't quote more than is needed, and respond after each quoted part.
From: Bwig Zomberi on 29 Jun 2010 01:26 Dr J R Stockton wrote: > In comp.lang.javascript message<9203324.ljVUCQOuko(a)PointedEars.de>, > Sun, 27 Jun 2010 11:16:59, Thomas 'PointedEars' Lahn > <PointedEars(a)web.de> posted: > >> And this is not a support forum, so nothing for >> you to probe, but a lot for you to learn. Learn to read and to ask smart >> questions to begin with. > > <FAQENTRY> An entry on Pointy-Head is needed, to explain the peculiar > nature of his personality and the general invalidity of such of his > opinions as are not traceable to ECMA-262. > It would be great if all CLJ regulars were covered and also mentioned who generally picks on who. Maybe Garret could create a separate page and link it in the FAQ. -- Bwig Zomberi
From: Garrett Smith on 29 Jun 2010 02:46
On 2010-06-28 10:26 PM, Bwig Zomberi wrote: > Dr J R Stockton wrote: >> In comp.lang.javascript message<9203324.ljVUCQOuko(a)PointedEars.de>, >> Sun, 27 Jun 2010 11:16:59, Thomas 'PointedEars' Lahn >> <PointedEars(a)web.de> posted: >> >>> And this is not a support forum, so nothing for >>> you to probe, but a lot for you to learn. Learn to read and to ask smart >>> questions to begin with. >> >> <FAQENTRY> An entry on Pointy-Head is needed, to explain the peculiar >> nature of his personality and the general invalidity of such of his >> opinions as are not traceable to ECMA-262. >> It's easy to point out flaws in others but you do your fair share of name-calling, and sometimes post occasional bible quotes. > > > It would be great if all CLJ regulars were covered and also mentioned > who generally picks on who. Maybe Garret could create a separate page > and link it in the FAQ. > I've got better things to do with my time than figure out how to writ an objective autobiographical synopsis of "PointedEars". I'd rather see a document that inspires useful contribution and productive discussion and discourages time-wasting and drama games. But then, given a choice of what to do with my time, I'd rather focus just on technical material. The good thing about this NG is a double-edged sword: Anybody can say anything. To make a positive contribution, eliminate any name calling. Have a positive attitude about making a useful contribution. You don't have to write a bunch of niceties or anything. A proposal to an FAQ entry is a good contribution (even though I disagree with what was proposed that I am replying to). A technical code review would be another great contribution. That is something I've been working on, among other things, actually. When its done, I'd like to add a link to it from the FAQ. And that, to me, seems more valuable and worthwhile use of my time than writing about PointedEars. Garrett |