We know the Img mark inside XHTML should write so: <img Alt= "" Src= "" /> , this kind writes a law namely so called shut oneself, be completely lawful in XML write a law. If you are familiar with the development related XML, the likelihood also is used to this kind writing a law, in thinking XML any do not contain child such the element of node is OK writing, such substantial label is OK also writing is done not have in XHTML so. The theory in XHTML is duped to allow any label to be written with the method that shuts oneself like that, however browser compatibility brought new issue however, that is IE cannot identify certain ticket correctly shut oneself write a law.
The attempt inputs code of the following XHTML and browse in IE please: <p>hello <script Type= "text/javascript" />World</p> , your meeting discovery can see the Hello in front only and do not see the World from the back, this thing makes a person quite indecipherable. The likelihood has many people to once had encountered this problem, and spent a few hours above cannot find logical explanation.
The explanation comes from additionally one paragraph of similar code: <p>hello <textarea />World</p> , you see your show the result in IE, can you receive logical explanation? We can see the Hello in front showed normally, after that the World of the face shows inside Textarea, this proves IE and did not identify Textarea label correctly to had been shut oneself, become it to was not shut however, identify the content from the back the content that is Textarea interior.
We are clear at that time in front why cannot that paragraph of code see the World from the back, because it is regarded as,the one part of Script identified. This explained, can not be like XML when we use XHTML optional in that way use what shut oneself to write a law, the label that only minority does not need to shut originally can use what shut oneself to write a law, although other label also had better be used without any content shut in couples write a law.
What need to remind everybody finally is, actually the Parser of mental retardation not just IE has, because Parser is not rigorous,a lot of places are come up against possibly and the problem that pose, so we still want to indulge a few old HTML to accede when writing XHTML the habit that come down, cannot be like true XML in that way flatter oneself accords with a standard write at will. Do not believe? So retry: <p>hello <br></br>World</p> , the indication effect in advertent IE and Opera.
Update: Having the case that partial reader thinks I am lifted do not accord with XHTML standard, so read XHTML standard first please. Chinese translates Empty Elements as follows: “ empty element must or has an end number, or with / > end, for example <br/> or <hr></hr> . Ask standard of referenced HTML compatibility in order to get about ensuring backward the information of compatible HTML4 browser. ” can look get, <hr></hr> also gave out in the standard such example, show <br></br> writing a law accord with XHTML standard, just do not have compatible HTML4 standard. So after all is XHTML compatible Where is HTML4? We come to see Compatibility Issues, chinese translates as follows: Although “ does not have the browser with requirement XHTML1.0 compatible and existing documentation, but in practice this is accomplished not hard. ” because this, XHTML is to did not stipulate documentation must is down compatible, the example that I give out is lawful XHTML documentation segment, also can pass the test and verify of W3C Markup Validation Service entirely when appearing inside complete XHTML.
Update Again: The purpose that actually I write this article is not to emphasize according with XHTML standard to go only, also not be to emphasize according with XHTML compatible HTML4 is enough at the same time, should consider more to need compatible situation however. The user allows to refer HTML in your CMS for example, referred HTML course SgmlReader is other perhaps XHTML of methodological format melt into, still did other XML processing probably at the same time, the <textarea></textarea> changeover that submits the user likely at that time is <textarea /> , you need to be debugged through dogging below this kind of circumstance it is not easy to find out a problem, be handled because of XML and did not violate any standards, the processing of each pace accords with semantics. Had better not write <br /> into <br/> additionally, because have the Parser of some of mental retardation really mere because little a blank space cannot identify correctly.
Bookmark:Digg Del.icio.us Reddit
