Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <8809769.VO6lmAGIsZ@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sun, 10 Feb 2013 01:07:23 +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> MIME-Version: 1.0 Lines: 62 NNTP-Posting-Date: 10 Feb 2013 01:07:24 CET NNTP-Posting-Host: 21f94ffc.newsspool3.arcor-online.net X-Trace: DXC=]:LH3TH4`W<=FQB?mjjV50McF=Q^Z^V384Fo<]lROoR18kF W dniu 2013-02-10 00:08, Thomas 'PointedEars' Lahn pisze: >> Cezary Tomczyk wrote: >>> W dniu 2013-02-07 20:32, Tim Slattery pisze: >>>> I have a tag that looks like this: >>>> >>>> Add >>>> Attachments >>> [...] >>> >>> My "5 cents": >>> >>> 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. >>> 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”. -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.