Click here to Skip to main content
14,667,947 members
Articles » Web Development » HTML / CSS » HTML5/CSS3 Article Contest
Tip/Trick
Posted 10 Oct 2014

Stats

5.4K views
3 bookmarked

New Proposed Attributes for HTML5

Rate this:
5.00 (1 vote)
Please Sign up or sign in to vote.
5.00 (1 vote)
10 Oct 2014CPOL
New proposed element to be added in W3C Candidate recommendation: 09 September 2014

Introduction

HTML5 is pushing itself very fast, every new recommendation comes with new elements, attributes.

Here are some attributes from candidate recommendation, and how to use them.

Reference: http://www.w3.org/html/wg/next/markup/

New Attributes

  • Capture
  • Inert
  • Inputmode
  • Download
  • Ping

Let's go to every one individually.

Capture

This attribute is related with HTML5 <input> element when type attribute is of type "file", i.e., file upload state, and its accept attribute is specified with any one of valid MIME types.

capture attribute is a boolean attribute, if specified true, then to capture the media directly from the device of user agent using Media capture mechanism.

The valid parameter will be:

capture

capture="capture"

Example:

<input type="file" name="video" accept="video/*" capture>
<input type="file" name="image" accept="image/*" capture>
<input type="file" name="audio" accept="audio/*" capture>

If capture is invoked, then User Agent should invoke the appropriate media capture mechanism.

Since capture depends on accept attribute, now if MIME type of accept have no specific control of media capture mechanism, then UserAgent will ignore the capture.

From the security point of view, the UserAgents have to rely on the commands from the end user.

  • User will be prompted for any such media access before capturing the content from microphones/cameras.
  • User will be prompted to terminate any such request.
  • User will be asked to choose among multiple media capture devices (if they exist.).
  • User can enable/disable sounds in video capture mode.

Inert

While using this Boolean attribute on a node (element, attributes,commands, etc.), the node of DOM will become unavailable for the UserAgent UA. This means the useragent will interpret as if it is unavailable for DOM events, even it will escape the text search (commonly know as “Find In Page”), and will block user from selecting text in the node.

The node in inert cannot be focused, and nodes that are commands (type, accesskey, etc.), that will also get disabled.

If Browsing Context (Environment (With WindowsProxy objects ) in which document objects are presented to user) is marked as inert, then its Nested Browsing Context (iframes, etc.) and all nodes in the document must be marked as inert.

Currently the dialog elements showModal() method makes use of this mechanism.

For Example

The modal dialog appears to disable the control behind it for selection, manipulation, text search although they may be visible.

Inputmode

Finally, this attribute had been added to HTML5 proposed attributes. It is specially meant for the browser on the devices with dynamic keyboard, about which type of keyboard to display.

This attributes applies to <input type ="text"/"search"/"password" ..> and <textarea>.

The value of Inputmode will range from latin, katkana, tel, email, url, etc. The advantage will be switching to the keyboard for typing only numbers, urls, etc.

<input mode="text" inputmode="numeric">

<input mode="text" inputmode="Latin">

Download

This attribute is related to <a> and <area> element.

download attribute if present will indicate the user agent as author has intended the hyperlink to be used for downloading some resources.

This attribute may(not) have the value, if value is present will specify the default file name specified by the author for local file system.

Suppose for example, an element contains monthly report like:

<a href ="files/monthlyReport/ewqaas23eOct2014.pdf" >Click Me!!</a>

When clicked, it will download the file with the same name ewqaas23eOct2014.pdf”, that doesn't sound good for the end user.

Now taking the help of download attribute:

<a href ="files/monthlyReport/october2014.pdf" 

download="ReportOctober2014">Click Me!!</a>

when clicked will download the report with name "ReportOctober 2014".

Ping

This element enables Hyperlink Auditing, when used on <a> element, it will ping the URLs entered (each separated by space), when user follows the hyperlink supplied on href attribute.

<a href ="www.HakkunaMatata.com" Ping="www.noworries.com">Click ME!!</a>

Here in ping attribute, we can enter multiple URLs separated by space.

To provide security features, the UA will provide the full support to user to handle the ping URLs, i.e. by prompting to Allow, or block, or even can disable the ping.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Shekhar Pankaj
Software Developer
India India
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --