HTML5和HTML4的不同英文.docx
《HTML5和HTML4的不同英文.docx》由会员分享,可在线阅读,更多相关《HTML5和HTML4的不同英文.docx(25页珍藏版)》请在冰豆网上搜索。
HTML5和和HTML4的不同英文的不同英文AbstractHTML5definesthefifthmajorrevisionofthecorelanguageoftheWorldWideWeb,HTML.HTML5differencesfromHTML4describesthedifferencesbetweenHTML4andHTML5andprovidessomeoftherationaleforthechanges.ThisdocumentmaynotprovideaccurateinformationastheHTML5specificationisstillactivelyindevelopment.Whenindoubt,alwayschecktheHTML5specificationitself.HTML5StatusofthisDocumentThissectiondescribesthestatusofthisdocumentatthetimeofitspublication.Otherdocumentsmaysupersedethisdocument.AlistofcurrentW3CpublicationsandthelatestrevisionofthistechnicalreportcanbefoundintheW3Ctechnicalreportsindexathttp:
/www.w3.org/TR/.Thisisthe13January2011W3CWorkingDraftproducedbytheHTMLWorkingGroup,partoftheHTMLActivity.TheWorkingGroupintendstopublishthisdocumentasaWorkingGroupNotetoaccompanytheHTML5specification.Theappropriateforumforcommentsispublic-html-commentsw3.org,amailinglistwithapublicarchive.PublicationasaWorkingDraftdoesnotimplyendorsementbytheW3CMembership.Thisisadraftdocumentandmaybeupdated,replacedorobsoletedbyotherdocumentsatanytime.Itisinappropriatetocitethisdocumentasotherthanworkinprogress.Thisdocumentwasproducedbyagroupoperatingunderthe5February2004W3CPatentPolicy.W3Cmaintainsapubliclistofanypatentdisclosuresmadeinconnectionwiththedeliverablesofthegroup;thatpagealsoincludesinstructionsfordisclosingapatent.AnindividualwhohasactualknowledgeofapatentwhichtheindividualbelievescontainsEssentialClaim(s)mustdisclosetheinformationinaccordancewithsection6oftheW3CPatentPolicy.TableofContents1.Introductiono1.1.OpenIssueso1.2.BackwardsCompatibleo1.3.DevelopmentModel2.Syntaxo2.1.CharacterEncodingo2.2.TheDOCTYPEo2.3.MathMLandSVGo2.4.Miscellaneous3.Languageo3.1.NewElementso3.2.NewAttributeso3.3.ChangedElementso3.4.Changedattributeso3.5.AbsentElementso3.6.AbsentAttributes4.APIso4.1.ExtensionstoHTMLDocumento4.2.ExtensionstoHTMLElement5.HTML5Changelogso5.1.Changessince19October2010o5.2.Changesfrom24June2010to19October2010o5.3.Changesfrom4March2010to24June2010o5.4.Changesfrom25August2009to4March2010o5.5.Changesfrom23April2009to25August2009o5.6.Changesfrom12February2009to23April2009o5.7.Changesfrom10June2008to12February2009o5.8.Changesfrom22January2008to10June2008AcknowledgmentsReferences1.IntroductionHTMLhasbeenincontinuousevolutionsinceitwasintroducedtotheInternetintheearly1990s.Somefeatureswereintroducedinspecifications;otherswereintroducedinsoftwarereleases.Insomerespects,implementationsandauthorpracticeshaveconvergedwitheachotherandwithspecificationsandstandards,butinotherways,theycontinuetodiverge.HTML4becameaW3CRecommendationin1997.WhileitcontinuestoserveasaroughguidetomanyofthecorefeaturesofHTML,itdoesnotprovideenoughinformationtobuildimplementationsthatinteroperatewitheachotherand,moreimportantly,withacriticalmassofdeployedcontent.ThesamegoesforXHTML1,whichdefinesanXMLserializationforHTML4,andDOMLevel2HTML,whichdefinesJavaScriptAPIsforbothHTMLandXHTML.HTML5willreplacethesedocuments.DOM2HTMLHTML4XHTML1TheHTML5draftreflectsaneffort,startedin2004,tostudycontemporaryHTMLimplementationsanddeployedcontent.Thedraft:
1.DefinesasinglelanguagecalledHTML5whichcanbewritteninHTMLsyntaxandinXMLsyntax.2.Definesdetailedprocessingmodelstofosterinteroperableimplementations.3.Improvesmarkupfordocuments.4.IntroducesmarkupandAPIsforemergingidioms,suchasWebapplications.1.1.OpenIssuesHTML5isstilladraft.ThecontentsofHTML5,aswellasthecontentsofthisdocumentwhichdependonHTML5,arestillbeingdiscussedontheHTMLWorkingGroupandWHATWGmailinglists.TheopenissuesarelinkedfromtheHTML5draft.1.2.BackwardsCompatibleHTML5isdefinedinawaythatitisbackwardscompatiblewiththewayuseragentshandledeployedcontent.Tokeeptheauthoringlanguagerelativelysimpleforauthorsseveralelementsandattributesarenotincludedasoutlinedintheothersectionsofthisdocument,suchaspresentationalelementsthatarebetterdealtwithusingCSS.Useragents,however,willalwayshavetosupporttheseolderelementsandattributesandthisiswhytheHTML5specificationclearlyseparatesrequirementsforauthorsanduseragents.Forinstance,thismeansthatauthorscannotusetheisindexortheplaintextelement,butuseragentsarerequiredtosupporttheminawaythatiscompatiblewithhowtheseelementsneedtobehaveforcompatibilitywithdeployedcontent.SinceHTML5hasseparateconformancerequirementsforauthorsanduseragentsthereisnolongeraneedformarkingfeaturesdeprecated.1.3.DevelopmentModelTheHTML5specificationwillnotbeconsideredfinishedbeforethereareatleasttwocompleteimplementationsofthespecification.Atestsuitewillbeusedtomeasurecompletenessoftheimplementations.ThisapproachdiffersfrompreviousversionsofHTML,wherethefinalspecificationwouldtypicallybeapprovedbyacommitteebeforebeingactuallyimplemented.Thegoalofthischangeistoensurethatthespecificationisimplementable,andusablebyauthorsonceitisfinished.2.SyntaxHTML5definesanHTMLsyntaxthatiscompatiblewithHTML4andXHTML1documentspublishedontheWeb,butisnotcompatiblewiththemoreesotericSGMLfeaturesofHTML4,suchasprocessinginstructionsandshorthandmarkupasthesearenotsupportedbymostuseragents.DocumentsusingtheHTMLsyntaxarealmostalwaysservedwiththetext/htmlmediatype.HTML5alsodefinesdetailedparsingrules(includingerrorhandling)forthissyntaxwhicharelargelycompatiblewithpopularimplementations.Useragentsmustusetheserulesforresourcesthathavethetext/htmlmediatype.HereisanexampledocumentthatconformstotheHTMLsyntax:
ExampledocumentExampleparagraphHTML5alsodefinesatext/html-sandboxedmediatypefordocumentsusingtheHTMLsyntax.Thiscanbeusedwhenhostinguntrustedcontent.TheothersyntaxthatcanbeusedforHTML5isXML.ThissyntaxiscompatiblewithXHTML1documentsandimplementations.DocumentsusingthissyntaxneedtobeservedwithanXMLmediatypeandelementsneedtobeputinthehttp:
/www.w3.org/1999/xhtmlnamespacefollowingtherulessetforthbytheXMLspecifications.XMLBelowisanexampledocumentthatconformstotheXMLsyntaxofHTML5.NotethatXMLdocumentsmustbeservedwithanXMLmediatypesuchasapplication/xhtml+xmlorapplication/xml.ExampledocumentExampleparagraph2.1.CharacterEncodingFortheHTMLsyntaxofHTML5,authorshavethreemeansofsettingthecharacterencoding:
Atthetransportlevel.ByusingtheHTTPContent-Typeheaderforinstance.UsingaUnicodeByteOrderMark(BOM)characteratthestartofthefile.Thischaracterprovidesasignaturefortheencodingused.Usingametaelementwithacharsetattributethatspecifiestheencodingwithinthefirst512bytesofthedocument.E.g.couldbeusedtospecifytheUTF-8encoding.Thisreplacestheneedforalthoughthatsyntaxisstillallowed.FortheXMLsyntax,authorshavetousetherulesassetforthintheXMLspecificationstosetthecharacterencoding.2.2.TheDOCTYPETheHTMLsyntaxofHTML5requiresaDOCTYPEtobespecifiedtoensurethatthebrowserrendersthepageinstandardsmode.TheDOCTYPEhasnootherpurposeandisthereforeoptionalforXML.DocumentswithanXMLmediatypearealwayshandledinstandardsmode.DOCTYPETheDOCTYPEdeclarationisandiscase-insensitiveintheHTMLsyntax.DOCTYPEsfromearlierversionsofHTMLwerelongerbecausetheHTMLlanguagewasSGML-basedandthereforerequiredareferencetoaDTD.WithHTML5thisisnolongerthecaseandtheDOCTYPEisonlyneededtoenablestandardsmodefordocumentswrittenusingtheHTMLsyntax.Browsersalreadydothisfor.2.3.MathMLandSVGTheHTMLsyntaxofHTML5allowsforMathMLandSVGelementstobeusedinsideadocument.E.g.averysimpledocumentusingsomeoftheminimalsyntaxfeaturescouldlooklike:
SVGintext/htmlAgreencircle:
Morecomplexcombinationsarealsopossible.E.g.withtheSVGforeignObjectelementyoucouldnestMathML,HTML,orbothinsideanSVGfragmentthatisitselfinsideHTML.2.4.MiscellaneousThereareafewothersyntaxchangesworthyofmentioning:
HTMLnowhasnativesupportforIRIs,thoughtheycanonlybefullyusedifthedocumentencodingisUTF-8orUTF-16.Thelangattributetakestheemptystringinadditiontoavalidlanguageidentifier,justlikexml:
langdoesinXML.3.LanguageThissectionissplitupinseveralsubsectionstomoreclearlyillustratethevariousdifferencestherearebetweenHTML4andHTML5.3.1.NewElementsThelinksinthissectionmaystopworkingifelementsarerenamedand/orremoved.Theyshouldfunctioninthelatestversionofthisdraft.Thefollowingelementshavebeenintroducedforbetterstructure:
sectionrepresentsagenericdocumentorapplicationsection.Itcanbeusedtogetherwiththeh1,h2,h3,h4,h5,andh6elementstoindicatethedocumentstructure.articlerepresentsanindependentpieceofcontentofadocument,suchasablogentryornewspaperarticle.asiderepresentsapieceofcontentthatisonlyslightlyrelatedtotherestofthepage.hgrouprepresentstheheaderofasection.headerrepresentsagroupofintroductoryornavigationalaids.footerrepresentsafooterforasectionandcancontaininformationabouttheauthor,copyrightinformation,etcetera.navrepresentsasectionofthedocumentintendedfornavigation.figurerepresentsapieceofself-containedflowcontent,typicallyreferenc