473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How does this work? (CDATA)

While visiting the apple.com page, I noticed an unusual
form behavior that seems pretty nice, but looking at the
source (below) it is unclear how it works. Is there a tutorial
that explains it? Thanks.

<div id="ppu-checker">
<form id="ppu-check-form" onsubmit="return false;" method="get"
action="http
://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wa/RSLID">
<p>
</p><div id="ppu-input-container" class="psearch
nonsafari"><label><
input name="ppu-postal-code" maxlength="" size="10" class="psearch
nonsafari" va
lue="Zip code" id="ppu-postal-code" type="text"><span id="ppu-input-
container-re
set"></span></label></div>
<script type="text/javascript">
// <![CDATA[
dojo.require("apple.widget.PrettySearchField");
var ppuinputcontainerObj = new apple.widget.PrettySearchField(
{
inputId: "ppu-postal-code",
containerId: "ppu-input-container",
resetIconId: "ppu-input-container-reset",
maxLength: "5",
results: "",
placeholder: "Zip code",
autosave: ""
}
);
// ]]>
</script>
Jun 27 '08 #1
6 3222
te*********@yahoo.com wrote:
While visiting the apple.com page, I noticed an unusual
form behavior that seems pretty nice, but looking at the
source (below) it is unclear how it works. Is there a tutorial
that explains it? Thanks.

<div id="ppu-checker">
<form id="ppu-check-form" onsubmit="return false;" method="get"
action="http
://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wa/RSLID">
<p>
</p><div id="ppu-input-container" class="psearch
nonsafari"><label><
input name="ppu-postal-code" maxlength="" size="10" class="psearch
nonsafari" va
lue="Zip code" id="ppu-postal-code" type="text"><span id="ppu-input-
container-re
set"></span></label></div>
<script type="text/javascript">
// <![CDATA[
dojo.require("apple.widget.PrettySearchField");
var ppuinputcontainerObj = new apple.widget.PrettySearchField(
{
inputId: "ppu-postal-code",
containerId: "ppu-input-container",
resetIconId: "ppu-input-container-reset",
maxLength: "5",
results: "",
placeholder: "Zip code",
autosave: ""
}
);
// ]]>
</script>
The CDATA lines have been commented out.
Jun 27 '08 #2
In article <v7******************************@giganews.com>,
sheldonlg <sheldonlgwrote:
te*********@yahoo.com wrote:
While visiting the apple.com page, I noticed an unusual
form behavior that seems pretty nice, but looking at the
source (below) it is unclear how it works. Is there a tutorial
that explains it? Thanks.

<div id="ppu-checker">
<form id="ppu-check-form" onsubmit="return false;" method="get"
action="http
://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wa/RSLID">
<p>
</p><div id="ppu-input-container" class="psearch
nonsafari"><label><
input name="ppu-postal-code" maxlength="" size="10" class="psearch
nonsafari" va
lue="Zip code" id="ppu-postal-code" type="text"><span id="ppu-input-
container-re
set"></span></label></div>
<script type="text/javascript">
// <![CDATA[
dojo.require("apple.widget.PrettySearchField");
var ppuinputcontainerObj = new apple.widget.PrettySearchField(
{
inputId: "ppu-postal-code",
containerId: "ppu-input-container",
resetIconId: "ppu-input-container-reset",
maxLength: "5",
results: "",
placeholder: "Zip code",
autosave: ""
}
);
// ]]>
</script>

The CDATA lines have been commented out.
It may be a WebObjects thing? Not sure, as I've never actually
poked into WebObjects, but Apple certainly has...
Jun 27 '08 #3
David Stone wrote:
In article <v7******************************@giganews.com>,
sheldonlg <sheldonlgwrote:
>te*********@yahoo.com wrote:
>>While visiting the apple.com page, I noticed an unusual
form behavior that seems pretty nice, but looking at the
source (below) it is unclear how it works. Is there a tutorial
that explains it? Thanks.

<div id="ppu-checker">
<form id="ppu-check-form" onsubmit="return false;" method="get"
action="http
://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wa/RSLID">
<p>
</p><div id="ppu-input-container" class="psearch
nonsafari"><label><
input name="ppu-postal-code" maxlength="" size="10" class="psearch
nonsafari" va
lue="Zip code" id="ppu-postal-code" type="text"><span id="ppu-input-
container-re
set"></span></label></div>
<script type="text/javascript">
// <![CDATA[
dojo.require("apple.widget.PrettySearchField");
var ppuinputcontainerObj = new apple.widget.PrettySearchField(
{
inputId: "ppu-postal-code",
containerId: "ppu-input-container",
resetIconId: "ppu-input-container-reset",
maxLength: "5",
results: "",
placeholder: "Zip code",
autosave: ""
}
);
// ]]>
</script>
The CDATA lines have been commented out.

It may be a WebObjects thing? Not sure, as I've never actually
poked into WebObjects, but Apple certainly has...
In XHTML, Script and Style element contents must be wrapped within a
CDATA marked section to avoid expansion of entities < and & as start of
markup and not to recognize &lt; and &amp; as < and & respectively. i.e.

<script>
<![CDATA[
... unescaped script content ...
]]>
</script>

The (//) are javascript single line comments - the CDATA start and end
tags are required for XHTML, but javascript will not see those lines.

--
Gus
Jun 27 '08 #4
Stefan Ram wrote:
Gus Richter <gu********@netscape.netwrites:
>In XHTML, Script and Style element contents must be wrapped within a
CDATA marked section to avoid expansion of entities < and & as start of

These characters can also be encoded by other
well-known means without »CDATA«.
XHTML _will_ expand the entities.
Javascript does _not_ want them expanded.
The CDATA marked sections will _avoid_ expansion of the entities in the
XHTML document _within the CDATA marked sections_.

--
Gus
Jun 27 '08 #5
Gus Richter wrote:
XHTML _will_ expand the entities.
Javascript does _not_ want them expanded.
The CDATA marked sections will _avoid_ expansion of the entities in the
XHTML document _within the CDATA marked sections_.
One good reason why those how do not understand the ramifications of
using XHTML should stick to HTML.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 27 '08 #6
Scripsit te*********@yahoo.com:
While visiting the apple.com page, I noticed an unusual
form behavior that seems pretty nice, but looking at the
source (below) it is unclear how it works. Is there a tutorial
that explains it? Thanks.
You'll find plenty of JavaScript tutorials, mostly poor, on the net.
JavaScript is not HTML. Followups trimmed.
<script type="text/javascript">
// <![CDATA[
If _this_ puzzles you, as "(CDATA)" on the Subject line suggests, then
you have a problem with HTML as well. You can simply read the HTML
specs, specifically
http://www.w3.org/TR/xhtml1/#h-4.8

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Richard | last post by:
www.geocities.com/r_bullis/test1.html At least this menu works in netscape. Disregarding the colors of the divisions. Those will be removed later. What I'm looking at doing is to have the...
3
by: Balaras | last post by:
Hi, Can sombody here please help me a bit with a regular expression. I have a xml file where I need to strip the CDATA sections of any contained data. Eg. <xml> <tag><]></tag>...
3
by: SĂ©bastien Ros | last post by:
I tries to migrate an existing application from 1.1 to 2.0 but it seems that one of my XPath expressions no more works on this version. I tried a SelectNodes().Count. The result is 1 in v1.1 and...
10
by: Jon Noring | last post by:
Out of curiosity, may a CDATA section appear within an attribute value with datatype CDATA? And if so, how about other attribute value datatypes which accept the XML markup characters? To me,...
2
by: Steveino | last post by:
Hello, Just wondering if anyone could shed any light on this, it's probably me just being silly... I have a dataset that I've used to create an XmlDataDocument, in order to apply XSL. The XSL...
2
by: Paul Verbelen | last post by:
I have a file with topics. I like to copy them in another file but want to have some blank lines between the different topics. I use <xsl:text> element with as data some blank lines to perform...
12
by: Peter Michaux | last post by:
Hi, I am experimenting with some of the Ruby on Rails JavaScript generators and see something I haven't before. Maybe it is worthwhile? In the page below the script is enclosed in //<!]> ...
4
by: Ross Presser | last post by:
I'm feeling very stupid about this ... pdf2html (http://pdf2html.sourceforge.net) is an app that reads a PDF and can generate HTML or XML; in my case I'm using the XML. The PDF I'm working with...
7
by: Max | last post by:
Hello everyone! Can anyone help me to convert the CDATA expression "CDATA ::= (Char* - (Char* ']]>' Char*)" to Javascript Regular Expression? Thanks, Max
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.