Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!news2.arglkargh.de!news.karotte.org!uucp.gnuu.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <1393459.e97MPUDCx7@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Mon, 17 Dec 2012 15:25:18 +0100 User-Agent: KNode/4.4.11 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+&. <50cf22cc$0$6847$e4fe514c@news2.news.xs4all.nl> Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 59 NNTP-Posting-Date: 17 Dec 2012 15:25:20 CET NNTP-Posting-Host: ef5d72b1.newsspool3.arcor-online.net X-Trace: DXC=AWoh9k\hYTWd=k8HTTRcBC "JJ" schreef […] >> "Tom de Neef" wrote: >>> Can someone indicate what I do wrong here: >>> {code} ^^^^^^ BTW, this is unnecessary and distracting here. >>> function removeStyleElement(scope) { >>> var sheets = document.styleSheets,k,sheet,rules,j,rule,s; >>> scope = scope.toLowerCase(); >>> for (k=sheets.length-1;k>=0;k--) { // skip the 'fixed' styles in >>> sheet[0] >>> sheet = sheets[k]; >>> // try { >>> rules = (sheet.cssRules)?sheet.cssRules:sheet.rules; //<<===== >>> // } >>> // catch (err) {return}; >>> if (rules) { >>> for (j=0;j>> rule = rules[j]; >>> s = (rule.selectorText)?rule.selectorText:rule; >>> if (s.toLowerCase() == scope) { >>> if (sheet.removeRule) {sheet.removeRule(j)} >>> else { if (sheet.deleteRule) sheet.deleteRule(j) }; >>> } >>> } >>> } >>> } >>> } >>> […] >> >> The statement in the disabled try...catch shouldn't cause problem. What's >> the exact exception error message when it occurs? > > There is no error message. When FF reaches that line, it jumps out and > stops execution (doesn't pick up in an enclosing block). Highly unlikely. > With the try .. catch included, it will jump to the catch statement. But I > do not know how to get information from the 'err' object. By inspecting it? By document.write()ing, window.alert()ing, console.log()ing it before you return? > The debugger doesn't show it. It should, and it does, unless its not showing it is related to your bad code style (you have the “catch” keyword, its /Block/ statement, and the “return” statement in the block on the same line). PointedEars -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, (2004)