JS strict warnings cleanup in connection with dialog work such as 47651, 47685. r=sfraser

This commit is contained in:
cmanske%netscape.com 2000-09-01 23:04:03 +00:00
Родитель 9850ca25cf
Коммит fb959cc64a
8 изменённых файлов: 28 добавлений и 26 удалений

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

@ -549,6 +549,7 @@ var nsSpellingCommand =
var spellChecker = window.editorShell.QueryInterface(Components.interfaces.nsIEditorSpellCheck);
if (spellChecker)
{
var firstMisspelledWord;
// Start the spell checker module. Return is first misspelled word
try {
spellChecker.InitSpellChecker();
@ -620,8 +621,8 @@ var nsHLineCommand =
// unless we are editing an existing line's attributes
// We get the last-used attributes from the prefs and insert immediately
tagName = "hr";
hLine = window.editorShell.GetSelectedElement(tagName);
var tagName = "hr";
var hLine = window.editorShell.GetSelectedElement(tagName);
if (hLine) {
// We only open the dialog for an existing HRule

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

@ -350,7 +350,7 @@ function editorSendPage()
function DocumentHasBeenSaved()
{
fileurl = "";
var fileurl = "";
try {
fileurl = window._content.location;
} catch (e) {
@ -1232,7 +1232,7 @@ function AppendRecentMenuitem(accessKey, menupopup, title, url)
{
if (menupopup)
{
menuItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem");
var menuItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem");
if (menuItem)
{
// Build the menuitem using the title (or url) and accesskey

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

@ -46,7 +46,6 @@ var gOutputEncodeEntities = 256;
// Use for 'defaultIndex' param in InitPixelOrPercentMenulist
var gPixel = 0;
var gPercent = 1;
var gLocation;
var maxPixels = 10000;
// For dialogs that expand in size. Default is smaller size see "onMoreFewer()" below
@ -201,7 +200,7 @@ function PrepareStringForURL(string)
// or disabled (setAttribute) as specified in the "doEnable" parameter
function SetElementEnabledById( elementID, doEnable )
{
element = document.getElementById(elementID);
var element = document.getElementById(elementID);
if ( element )
{
if ( doEnable )
@ -279,13 +278,14 @@ function InitPixelOrPercentMenulist(elementForAtt, elementInDoc, attribute, menu
ClearMenulist(menulist);
pixelItem = AppendStringToMenulist(menulist, GetString("Pixels"));
if (!pixelItem)
return;
if (!pixelItem) return 0;
percentItem = AppendStringToMenulist(menulist, GetAppropriatePercentString(elementForAtt, elementInDoc));
if (size && size.length > 0)
{
// Search for a "%" character
percentIndex = size.search(/%/);
var percentIndex = size.search(/%/);
if (percentIndex > 0)
{
// Strip out the %
@ -324,7 +324,7 @@ function AppendStringToMenulist(menulist, string)
return null;
}
}
menuItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem");
var menuItem = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "menuitem");
if (menuItem)
{
menuItem.setAttribute("value", string);
@ -670,7 +670,7 @@ function getColorAndSetColorWell(ColorPickerID, ColorWellID)
// Test for valid image by sniffing out the extension
function IsValidImage(imageName)
{
image = imageName.trimString();
var image = imageName.trimString();
if ( !image )
return false;
@ -688,16 +688,16 @@ function IsValidImage(imageName)
type = type.toLowerCase();
// TODO: Will we convert .BMPs to a web format?
switch( type ) {
switch( type )
{
case "gif":
case "jpg":
case "jpeg":
case "png":
return true;
break;
default :
return false;
}
return false;
}
function InitMoreFewer()
@ -922,13 +922,10 @@ function SetWindowLocation()
gLocation = document.getElementById("location");
if (gLocation)
{
offsetX = Number(gLocation.getAttribute("offsetX"));
offsetY = Number(gLocation.getAttribute("offsetY"));
dump(" *** Dialog offsets: x="+offsetY+", y="+offsetY+"\n");
var newX = Math.min(window.opener.screenX + offsetX, screen.availWidth - window.outerWidth);
var newY = Math.min(window.opener.screenY + offsetY, screen.availHeight - window.outerHeight)
window.screenX = Math.max(0, newX);
window.screenY = Math.max(0, newY);
window.screenX = Math.max(0, Math.min(window.opener.screenX + Number(gLocation.getAttribute("offsetX")),
screen.availWidth - window.outerWidth));
window.screenY = Math.max(0, Math.min(window.opener.screenY + Number(gLocation.getAttribute("offsetY")),
screen.availHeight - window.outerHeight));
}
}

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

@ -26,6 +26,7 @@ var width;
var height;
var align;
var shading;
var dialog;
// dialog initialization code
function Startup()

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

@ -31,6 +31,8 @@ var imageElement;
var imageMap = 0;
var canRemoveImageMap = false;
var imageMapDisabled = false;
var dialog;
var globalMap;
// dialog initialization code
@ -144,7 +146,7 @@ function InitDialog()
{
// Set the controls to the image's attributes
str = globalElement.getAttribute("src");
var str = globalElement.getAttribute("src");
if (str)
dialog.srcInput.value = str;

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

@ -30,6 +30,7 @@ var maxColumns = 10000;
var maxPixels = 10000;
var rows;
var columns;
var dialog;
// dialog initialization code
function Startup()

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

@ -156,14 +156,14 @@ function Startup()
{
// We get here if selection is exactly around a link node
// Check if selection has some text - use that first
selectedText = GetSelectionAsText();
var selectedText = GetSelectionAsText();
if (selectedText.length == 0)
{
// No text, look for first image in the selection
var children = anchorElement.childNodes;
if (children)
{
for(i=0; i < children.length; i++)
for(var i=0; i < children.length; i++)
{
var nodeName = children.item(i).nodeName.toLowerCase();
if (nodeName == "img")
@ -233,7 +233,7 @@ function InitDialog()
function chooseFile()
{
// Get a local file, converted into URL format
fileName = GetLocalFileURL("html");
var fileName = GetLocalFileURL("html");
if (fileName) {
dialog.hrefInput.value = fileName;
// Call this to do OK button enabling

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

@ -99,7 +99,7 @@ function ChangeName()
function AnchorNameExists(name)
{
anchorList = editorShell.editorDocument.anchors;
var anchorList = editorShell.editorDocument.anchors;
if (anchorList) {
for (var i = 0; i < anchorList.length; i++) {
if (anchorList[i].name == name)