Closed Bug 288988 Opened 20 years ago Closed 20 years ago

JavaScript doesn't work if I put Prolog XML in the top of page together XHTML DocType

Categories

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

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: marcocurto, Unassigned)

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.7.6) Gecko/20050318 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.7.6) Gecko/20050318 Firefox/1.0.2

I've a form page in my web site that has some fields verifications using
JavaScript, but, my page is according with Web Standards of W3C. In my page, I'm
using (XHTML 1.0 + CSS + JavaScript);
So, when I put the XML prolog in the TOP of the page with the XHTML DocType, my
JavaScript code doesn't work!
The JavaScript code just works, when put a specific XHTML DocType without XML
Prolog. See the folowings examples:

---------------------------------------------------------------------------
Code 1 (Better code) - JavaScript doesn't work:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt" lang="pt">

---------------------------------------------------------------------------
Code 2 - JavaScript works

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

---------------------------------------------------------------------------
Important note: In any of two cases, the page layout doesn't have any design
modification. The only diference is the JavaScript Working.

Reproducible: Always

Steps to Reproduce:
1.You need to create a web page that contains a form with some fields and a
button "OK";
2.In the top of page, include the following code:
  <?xml version="1.0" encoding="iso-8859-1"?>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt" lang="pt">
3.In the click event of the "OK" button, verify if the fields of the form are
empty using JavaScript;
4.Pay atention if JavaScript is working correctly.
Actual Results:  
JavaScript doesn't work... It seems that the page hasn't any JavaScript code.

Expected Results:  
JavaScript must work to verify the contains of the fields.
Severity: major → minor
Component: Disability Access → Java: OJI
Product: Firefox → Core
Version: unspecified → 1.7 Branch
Could you post a test case please ?
Attached file The main page test.
Attached file The style page.
You need to save all the files in the same directory to test the application.
Javascript does werify content of the cases here to. Using Mozilla/5.0 (Windows;
U; Windows NT 5.1; en-US; rv:1.8b2) Gecko/20050404 Firefox/1.0+
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: 1.7 Branch → Trunk
Attachment #179612 - Attachment mime type: application/octet-stream → application/x-javascript
from the javascript console:
Error: frmContato is not defined
Source File: file:///tmp/page.htm
Line: 34
Assignee: aaronleventhal → general
Component: Java: OJI → DOM: Level 0
QA Contact: bugzilla → ian
fwiw that page is not at all valid XHTML (unescaped <, at least)

elements are only exposed by ID/NAME in global scope in quirks mode. quirks mode
is triggered by lack of a URI in the doctype, basically.

so, to access your form, prefix accesses to it with "document.". This is not a bug.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: