Re: DOM-scripting -- FF problem
- From: Thomas 'PointedEars' Lahn <PointedEars@xxxxxx>
- Date: Sat, 02 May 2009 19:32:22 +0200
David Mark wrote:
SAM wrote:
Le 5/2/09 8:12 AM, maya a écrit :
I'm working on validation for a form..As you are in XHTML begin by doing :
http://www.mayacove.com/dev/js/mail.html
<script type="text/javascript">
// <![CDATA[
// ]]>
</script>
(inserting the special comments cdata)
The document is not *served* as XML
That is true. A document can not be "served as XML"; either it is an XML
document or of an XML-based document type (e.g. XHTML 1.0 Transitional), or
it is not. However, a markup document can be declared as of ("served as")
an XML-based *media* type (e.g. application/xhtml+xml) or not, which is
likely to trigger the user agent used for parsing the markup: XML-based
media types, if supported, SHOULD trigger an XML parser, while SGML-based
media types usually trigger a tag-soup parser, or (seldom) an SGML parser.
and the above syntax wouldn't make sense if it was.
If the document type was an XHTML document type, the above syntax prevented
the author from escaping the markup characters `<', `>' and `&' in the
script code which would be necessary in order to achieve a Valid document
because the content model of the XHTML `script' element is PCDATA (Parsed
Character DATA). (That would, of course, be independent of the declared
media type and of which user agent was eventually selected to render the
document.) The recommended alternatives are to refer to script resources
with the `src' attribute, or not to use XHTML. See the XHTML 1.0
Specification, Second Edition, section 4.8.
It won't do anything for documents served as HTML either.
The "either" aside, exactly that is the beauty of it. In HTML, the content
model of the SCRIPT element is CDATA (Character DATA) instead where,
consequently, markup characters are regarded literal characters without
attached meaning. The single-line comment syntax of `//', which does not
need to be escaped in PCDATA, prevents the script engine from regarding this
line as a non-comment, regardless of the actual content model as implemented
by the actual user agent.
It's the JS equivalent of an urban myth.
You are mistaken.
problem is in FF, messages inserted in error div disappear after theytry :
show up... I've never seen this before..
<form action="" onsubmit="return validate()">
or :
<form action="" onsubmit="return sendMail()">
In all cases onsubmit will have to return false
Unless the request fails immediately. Scripting may be disabled as
well, so you need an action.
The value of the `action' attribute of the `form' element may be the empty
string. In that case, it is supposed to be regarded by the user agent as a
"same-document" relative URI-reference. This can make sense for documents
that use client-side scripting to parse the query-part of the request URI,
or for documents that are generated by a server-side application. See the
HTML 4.01 Specification, section 17.3, and RFC 3986, section 4.4.
PointedEars
.
- Follow-Ups:
- Re: DOM-scripting -- FF problem
- From: Eric Bednarz
- Re: DOM-scripting -- FF problem
- From: David Mark
- Re: DOM-scripting -- FF problem
- References:
- DOM-scripting -- FF problem
- From: maya
- Re: DOM-scripting -- FF problem
- From: SAM
- Re: DOM-scripting -- FF problem
- From: David Mark
- DOM-scripting -- FF problem
- Prev by Date: Re: position javascript pop-up calendar entirely on page
- Next by Date: Re: DOM-scripting -- FF problem
- Previous by thread: Re: DOM-scripting -- FF problem
- Next by thread: Re: DOM-scripting -- FF problem
- Index(es):
Relevant Pages
|