A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on Chat (such as one of these permanent autoconfirmed members).

MicrosyntaxDescriptions: Difference between revisions

From WHATWG Wiki
Jump to navigation Jump to search
(→‎date-or-time: remove reference to ISO 8601)
Line 30: Line 30:


==date-or-time==
==date-or-time==
A [http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-date-string-with-optional-time valid date string with optional time]; that is: a <b>date</b>, which must be in the form <code><i>YYYY</i>-<i>MM</i>-<i>DD</i></code>, optionally followed by “<code>T</code>” and a <b>time</b>, which must begin in the form <code><i>hh</i>:<i>mm</i></code>, and can optionally be followed by <code>:<i>ss</i></code>, optionally followed by “<code>.</code>” and one or more digits, optionally followed a time zone designator. which must be either “<code>Z</code>”, or in the form <code>+<i>hh</i>:<i>mm</i></code> or the form <code>-<i>hh</i>:<i>mm</i></code>. Examples: <code>1996-01-01T12:05:25</code>, <code>1996-01-01</code>, <code>1996-01-01T12:05:25.6-02:00</code>. <i>Note: The HTML specification prohibits a time without a date—for example, <code>12:05:25</code>—but the validator currently allows it.</i>
A [http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-date-string-with-optional-time valid date string with optional time]; that is: a <b>date</b>, which must be in the form <code><i>YYYY</i>-<i>MM</i>-<i>DD</i></code>, optionally followed by “<code>T</code>” and a <b>time</b>, which must begin in the form <code><i>hh</i>:<i>mm</i></code>, and can optionally be followed by <code>:<i>ss</i></code>, optionally followed by “<code>.</code>” and one or more digits, optionally followed a time zone designator, which must be either “<code>Z</code>”, or in the form <code>+<i>hh</i>:<i>mm</i></code> or the form <code>-<i>hh</i>:<i>mm</i></code>. Examples: <code>1996-01-01T12:05:25</code>, <code>1996-01-01</code>, <code>1996-01-01T12:05:25.6-02:00</code>. <i>Note: The HTML specification prohibits a time without a date—for example, <code>12:05:25</code>—but the validator currently allows it.</i>


==datetime==
==datetime==

Revision as of 03:10, 1 August 2011

The purpose of this page is to enable collaborative creation of brief advisory text for each HTML5 microsyntax so that when the content of an attribute value or the text content of an element does not conform to a given microsyntax, a validator can display the advisory text about the syntax to guide the author to fix the content. Note that like the rest of this wiki, editing requires you to agree to release your contributions under the MIT license (see wiki footer). Please note that while copying text from the WHATWG version of HTML 5 is OK, copying text from RFCs or W3C specs is not OK.

Note that some formats pertain to Web Forms 2.0 (e.g. datetime-local).

Please keep descriptions short: one paragraph in length.

a-rel

A whitespace-separated list of link types listed as allowed on <a> and <area> in the HTML specification or listed as an allowed on <a> and <area> on the Microformats wiki without duplicate keywords in the list. You can register link types on the Microformats wiki yourself.

browsing-context

A browsing context name is any string that does not start with an underscore (_).

browsing-context-or-keyword

A browsing context name or keyword is either any string that does not start with an underscore (_) or a string that case-insensitively matches one of: _blank, _self, _parent, or _top.

cdo-cdc-pair

Any text content that does not contain the character sequence "<!--" without a later occurrence of the character sequence "-->".

charset

An encoding name labeled as a "preferred MIME name" in the IANA Character Sets registry. Example: utf-8

charset-list

A whitespace-separated list of encoding names labeled as a "preferred MIME name" in the IANA Character Sets registry. Example: utf-8 us-ascii

circle

A circle is specified as three comma-separated (no spaces allowed) integers the last one of which is non-negative. An integer consists of one or more digits (09), optionally preceded by a hyphen (-). Examples of circles: 5,5,10 and -5,0,20

date

A date in the format YYYY-MM-DD. Example: 2002-09-29.

date-or-time

A valid date string with optional time; that is: a date, which must be in the form YYYY-MM-DD, optionally followed by “T” and a time, which must begin in the form hh:mm, and can optionally be followed by :ss, optionally followed by “.” and one or more digits, optionally followed a time zone designator, which must be either “Z”, or in the form +hh:mm or the form -hh:mm. Examples: 1996-01-01T12:05:25, 1996-01-01, 1996-01-01T12:05:25.6-02:00. Note: The HTML specification prohibits a time without a date—for example, 12:05:25—but the validator currently allows it.

datetime

An ISO 8601 date and time in the UTC time zone, i.e. YYYY-MM-DDThh:mm optionally followed by :ss for the seconds, optionally followed by . and one or more digits for the fraction of a second, and finally followed by Z. Examples: 1996-01-01T12:05Z, 1996-01-01T12:05:25.6Z.

datetime-local

An ISO 8601 date and time with no time zone information, i.e. YYYY-MM-DDThh:mm optionally followed by :ss for the seconds, optionally followed by . and one or more digits for the fraction of a second. Examples: 1996-01-01T12:05, 1996-01-01T12:05:25.6.

datetime-tz

(This format deviates from the spec draft.) An ISO 8601 date and time with a time zone designator, i.e. YYYY-MM-DDThh:mm:ss optionally followed by . and one or more digits for the fraction of a second, and finally followed by either Z, +hh:mm or -hh:mm. Examples: 1996-01-01T12:05:25Z, 1996-01-01T12:05:25.6+02:00.

email

An e-mail address must match the addr-spec production defined in RFC 2822 section 3.4.1 excluding the CFWS production everywhere and excluding the FWS production everywhere except in the quoted-string production.

float

First, optionally, - (U+002D). Then, a series of one or more characters in the range 09. Then, optionally, a single . (U+002E) followed by a series of one or more characters in the range 09. Then, optionally, either e or E, optionally followed by - (U+002D) or + (U+002B), followed by a series of one or more characters in the range 09. For example, -42.42E+42 is valid but .5 or +2 are not.

float-non-negative

A series of one or more characters in the range 09. Then, optionally, a single . (U+002E) followed by a series of one or more characters in the range 09. Then, optionally, either e or E, optionally followed by - (U+002D) or + (U+002B), followed by a series of one or more characters in the range 09. Or, alternatively to the foregoing: First, - (U+002D). Then, a series of one or more zeros. Then, optionally, a single . (U+002E) followed by one or more zeros. Then, optionally, either e or E, optionally followed by - (U+002D) or + (U+002B), followed by a series of one or more characters in the range 09. For example, 42.42E+42 and -000.000 are valid but .5 or -0.01 are not.

float-positive

A series of one or more characters in the range 09. Then, optionally, a single . (U+002E) followed by a series of one or more characters in the range 09. One of the digits so far has to be non-zero. Then, optionally, either e or E, optionally followed by - (U+002D) or + (U+002B), followed by a series of one or more characters in the range 09. For example, 42.42E+42 is valid but 0.0 or -2 are not.

hash-name

A # (number sign) character followed by any string.

ID

An ID consists of at least one character but must not contain any whitespace.

integer

One or more digits (09), optionally preceded by a hyphen (-). For example: 42 and -273 are valid, but +42 is not.

integer-non-negative

One or more digits (09). For example: 42 and 0 are valid, but -273 is not.

integer-positive

One or more digits (09), with at least one which is non-zero. For example: 42 is valid, but 00 is not.

iri

An absolute URL. For example: http://example.org/hello, but not /hello. Spaces should be escaped as %20.

iri-ref

Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20.

language

An RFC 5646 language tag consists of hyphen-separated ASCII-alphanumeric subtags. There is a primary tag identifying a natural language by its shortest ISO 639 language code (e.g. en for English) and zero or more additional subtags adding precision. The most common additional subtag type is a region subtag which most commonly is a two-letter ISO 3166 country code (e.g. GB for the United Kingdom). IANA maintains a registry of permissible subtags.

link-rel

A whitespace-separated list of link types listed as allowed on <link> in the HTML specification or listed as an allowed on <link> on the Microformats wiki without duplicate keywords in the list. You can register link types on the Microformats wiki yourself.

media-query

One or more media queries, combined in a comma-separated list. Each media query consists of a media type and zero or more expressions that check for the conditions of particular media features. A media type is one of the following: all, braille, embossed, handheld, print, projection, screen, speech, tty, or tv. Note: The aural media type is deprecated. For information about valid media features and about the exact syntax of media queries, see the Media Queries specification.

meta-charset

The string text/html;, optionally followed by whitespace, followed by charset=, followed by an encoding name labeled as a "preferred MIME name" in the IANA Character Sets registry. Example: text/html; charset=utf-8

meta-name

A metadata name listed in the HTML specification or listed in the WHATWG wiki. You can register metadata names on the WHATWG wiki yourself.

mime-type

A media-type as defined in RFC 2616; that is, typically, a required type, followed by a "/" character, followed by a required subtype, optionally followed by one or more instances of a ";" character followed by a parameter. Examples: text/css, text/css;charset=utf-8.

mime-type-list

(WF2)

month

An ISO 8601 date with year and month, i.e. YYYY-MM. Example: 2007-11.

non-empty-string

Any string that is not the empty string.

pattern

(WF2)

polyline

...

ratio

(progress content)

rectangle

...

script

Any text content that does not contain the character sequence "<!--" without a later occurrence of the character sequence "-->" and that does not contain any occurrence of the string "</script" followed by a space character, ">", or "/". For further details, see Restrictions for contents of script elements.

script-documentation

Zero or more code comments, each of which is either a single-line comment starting with "//" or a multi-line comment starting with "/*" and ending with "*/". The content must also meet the constraints of the script microsyntax. For further details, see Inline documentation for external scripts.

simple-color

A string of seven characters that starts with # and ends with six characters each of which is 09, af or AF.

string-without-line-breaks

Any string that does not contain the carriage return character or the line feed character.

time

A time (hour, minute, seconds, fractional seconds) is encoded according to ISO 8601 with no time zone: two digits (09) for the hour, a colon, two digits for the minute, optionally a colon and two digits for the second, and optionally (if the seconds are present) a period (.) and one or more digits for the fraction of a second. All the numbers must be in base ten and zero-padded if necessary. For instance: 23:59:00.00000 or 00:00:05.

week

A week consists of a year and a week number encoded according to ISO 8601: four or more digits (09) representing the year, a hyphen (-), a literal W, and two digits for the week, zero-padded if necessary. The week number must be a number greater than or equal to 01. Week 01 of a given year is the week containing the 4th of January; weeks start on Monday. For instance: 2005-W52 is the week that ended on Sunday the first of January, 2006.