Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Javascript crasht FF

Empfohlene Antworten

Veröffentlicht

Nabend allerseits,

ich bin gerade dabei einen kleinen JS-Tree zu schreiben. Läuft auch alles ganz gut, abgesehen von dem Punkt dass eine kleine Funktion dauernd meinen FF crasht und ich nicht weiß wieso.


	function hasChildren(node) {


		for ( i=0; i<node.childNodes.length; i++) {

			if ( node.childNodes[i].tagName ) {

				var t = node.childNodes[i].tagName.toLowerCase();

				if ( t=="li" || t=="ul" ) {

					return true;

				}

			}

		}

		return false;

	}

Irgendeine Idee?

Als parameter wird ein LI element übergeben.

Wenn ich den if ( t=='' || t=='' ) auskommentiere läufts...

ich nutze FF 2.0.0.9 mit Firebug.

gruß

Jan

Problem gefunden ;)

Aus irgendeinem merkwürdigen Grund steht der FF überhaupt nicht auf nicht initialisierte Variablen.

Aus


for ( i=0; i<node.childNodes.length; i++) {

wird ganz einfach

for ( var i=0; i<node.childNodes.length; i++) {

und der browser stürzt nicht mehr ab.

gruß

Jan

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.