Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <2710705.sg4g0aCLjx@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sun, 10 Feb 2013 01:27:28 +0100 User-Agent: KNode/4.8.5 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. tag in IE Newsgroups: comp.lang.javascript References: <2542700.24A3Wqytjl@PointedEars.de> <8809769.VO6lmAGIsZ@PointedEars.de> MIME-Version: 1.0 Lines: 68 NNTP-Posting-Date: 10 Feb 2013 01:27:29 CET NNTP-Posting-Host: 21f94ffc.newsspool3.arcor-online.net X-Trace: DXC=g\n4PNlId5I[kmHKHnaEnMMcF=Q^Z^V3H4Fo<]lROoRA8kF W dniu 2013-02-10 01:07, Thomas 'PointedEars' Lahn pisze: >> Cezary Tomczyk wrote: > [...] >>>>> 1. Don't mix behaviours with logic. Move "onclick" outside of element >>>>> . >>>> >>>> You have not said why. I think there is no good reason why. That >>>> script code here is short enough so that it is maintainable when in an >>>> event handler attribute value, and it is only needed when that >>>> particular “a” >>>> element is needed. Loading it always would be a waste of resources. >>> >>> I am referring to: >>> >>> * http://en.wikipedia.org/wiki/Unobtrusive_JavaScript#Separation_of_behavior_from_markup >>> * http://www.w3.org/wiki/The_principles_of_unobtrusive_JavaScript#Separation_of_structure_and_behaviour >>> >>> There is a lot of materials in internet about (let's use some keywords) >>> "separate behavior content javascript". >>> >>> Plus ( from my memory :-) ): >>> >>> * HTML files are bigger by using inline events and are not cached, while >>> JavaScript files can be cached by browsers >> >> Utter nonsense, all of the above. > > You have not said why. True, because we have been over this ad nauseam here already. >>>>> A good example was provided by Thomas Lahn (he's second example). >>>> Which “second example” are you referring to? >>> >>> [...] >>> a.onclick = function () { >>> addAttachments(); >>> return false; >>> }; >>> [...] >>> >>> which means that attaching method to event could be done, for example, >>> in that way. Not by using inline events. >> This code is part of an example in which the “a” element is created >> dynamically. It has nothing to do with some misguided idea of >> “Unobtrusive JavaScript”. > > The code contains an fragment of adding event and method. That part I > wanted to cite as an example of way how to add events and methods in a > proper way. Not by inline events. My example has nothing to do with that mindbogglingly stupid approach. Do not cite it as an example of that. > Also, I provided links that contains explanations "why not inline events". > You do not have to agree with them. I do not, because they are utter nonsense. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.