9
Mohamed Fadel Buffon

Escaping style and script data

Embed Size (px)

DESCRIPTION

Escaping style and script data in old browsers didn't support them and dealing with the xhtml besides html.

Citation preview

Page 1: Escaping style and script data

Mohamed Fadel Buffon

Page 2: Escaping style and script data

Make them believe that the data is inside acomment.

For example :

Page 3: Escaping style and script data

With the script element, use a single lineECMAScript comment (//) to hide the endtoken from browsers .

For example :

Page 4: Escaping style and script data

In HTML, their contents aredefined as CDATA, meaningeverything from the start of thecontents to the next occurrence ofthe closing token (</ in this case)is considered character data thatisn't parsed as markup.

Page 5: Escaping style and script data

in XHTML their contents aredefined as PCDATA, meaning thecontents are parsed as markup.

If you wish to include < and &characters in your script or style

sheet, you will run into problems.

Page 6: Escaping style and script data

in XHTML, you must mark up aspecial CDATA section.

So, use the styling or scriptinglanguage to comment out theCDATA section markers.

Page 7: Escaping style and script data

For example:

Page 8: Escaping style and script data

to write XHTML that can also be handled bycommon HTML user agents as well as old browsersthat don't support the style and script elements.

Page 9: Escaping style and script data

Contact : [email protected]