Closed Bug 224952 Opened 21 years ago Closed 21 years ago

javascript: iframe_element.src = href remain NULL

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: gary, Assigned: jst)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.21  [en]
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 Firebird/0.7

An iframe element's SRC cannot be set through javascript.

Reproducible: Always

Steps to Reproduce:
1. Click on a row in the files table
2. Servers page slide out

Actual Results:  
Empty iframe, which is set to a URL.

Expected Results:  
http://isohunt.com/servers.php should be loaded inside iframe, instead of 
iframe_element.src remaining NULL.

The javascript triggered onClick below:

function servOC(i, href, nColor) {
  var trObj = (document.getElementById) ? document.getElementById('ihtr' + i) : 
eval("document.all['ihtr" + i + "']");
  var nameObj = (document.getElementById) ? document.getElementById('name' + i) 
: eval("document.all['name" + i + "']");
  var ifObj = (document.getElementById) ? document.getElementById('ihif' + i) : 
eval("document.all['ihif" + i + "']");
  if (trObj != null) {
    if (trObj.style.display=="none") {
      trObj.style.display="";
      nameObj.style.background="#ECECD9";
      if (ifObj.src == "") ifObj.src = href;
      smoothHeight('ihif' + i, 0, 210, 42, 'o');
    }
    else {
      nameObj.style.background=nColor;
      smoothHeight('ihif' + i, 210, 0, 42, 'ihtr' + i);
    }
  }
}

Someone reported this problem exists for Mozilla 1.5 as well, so it's likely a 
new bug introduced to the DOM model recently. I've tested the javascript in 
earlier versions of both Mozilla and Firebird and this problem did not happen 
before.
>      if (ifObj.src == "") ifObj.src = href;

That test fails.  When the src attribute us not set, we return null for the src
property and |null == ""| is false). Just testing (!ifObj.src) should work for
you, I think.

caillon, we return null because of your review comments in bug 212277... I
suspect we may want to revert it to returning empty string if it breaks too many
things.  jst, thoughts?
.
Assignee: events → general
Component: DOM Events → DOM Core
OS: Windows XP → All
Hardware: PC → All
Interesting, it works. ^.^

But please do keep some level of backward compatibility, as all browsers, 
including Mozilla previously, did not return false on assessing (ifObj.src == 
"").
we want to make a call one way or the other here by 1.6, in my opinion.... 
Assigning to jst to get an executive decision handed down, hopefully...
Assignee: general → jst
For compatibility's sake, revert back to returning "" for no URI attribute.
Attachment #136018 - Flags: superreview?(bz-vacation)
Attachment #136018 - Flags: review?(caillon)
Attachment #136018 - Flags: review?(caillon) → review+
Comment on attachment 136018 [details] [diff] [review]
Make iframe.src default to ""

sr=bzbarsky

Could this please be approved for 1.6b?  We don't really want to break this.
Attachment #136018 - Flags: superreview?(bz-vacation)
Attachment #136018 - Flags: superreview+
Attachment #136018 - Flags: approval1.6b?
Attachment #136018 - Flags: approval1.6b? → approval1.6b+
Fixed.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Component: DOM: Core → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: