Fixed null return from getAttribute that killed toolbar, b=106733, r=hwaara,sr=kin; fix for JS warning by Neil, b=106224, r=cmanske, sr=kin

This commit is contained in:
cmanske%netscape.com 2001-10-26 18:43:25 +00:00
Родитель e101daceeb
Коммит 5fcd690515
1 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -1201,8 +1201,8 @@ function SetEditMode(mode)
gSourceContentWindow.value = source.slice(start); gSourceContentWindow.value = source.slice(start);
gSourceContentWindow.focus(); gSourceContentWindow.focus();
// Set oninput handler so we know if user made any changes // Add input handler so we know if user made any changes
gSourceContentWindow.setAttribute("oninput", "oninputHTMLSource();"); gSourceContentWindow.addEventListener("input", oninputHTMLSource, false);
gHTMLSourceChanged = false; gHTMLSourceChanged = false;
} }
else if (previousMode == DisplayModeSource) else if (previousMode == DisplayModeSource)
@ -1242,6 +1242,9 @@ function SetEditMode(mode)
} }
editorShell.EndBatchChanges(); editorShell.EndBatchChanges();
} else {
// We don't need to call this again, so remove handler
gSourceContentWindow.removeEventListener("input", oninputHTMLSource, false);
} }
gHTMLSourceChanged = false; gHTMLSourceChanged = false;
@ -1261,8 +1264,7 @@ function oninputHTMLSource()
goUpdateCommand("cmd_save"); goUpdateCommand("cmd_save");
// We don't need to call this again, so remove handler // We don't need to call this again, so remove handler
// (Note: using "removeAttribute" didn't work!) gSourceContentWindow.removeEventListener("input", oninputHTMLSource, false);
gSourceContentWindow.setAttribute("oninput", null);
} }
function ResetWindowTitleWithFilename() function ResetWindowTitleWithFilename()
@ -1853,8 +1855,8 @@ function EditorSetDefaultPrefsAndDoctype()
node = nodelist.item(i); node = nodelist.item(i);
if ( node ) if ( node )
{ {
var value = node.getAttribute("name").toLowerCase(); var value = node.getAttribute("name");
if (value == "author") if (value && value.toLowerCase() == "author")
{ {
authorFound = true; authorFound = true;
} }