News

Add new post

HTML5 tag proposal : sandbox

HTML5

HTML has evolved beyond the original 22 tags; and so has evolved the web and the supporting infrastructure around consuming HTML. Things are getting even more interesting with content being published (and micro-published) and then embedded (videos, widgets, scripts) as content within content. The content within the content (or micro-content) is (a) infrastructure driven, like embedding of scriptlets for web tracking (b) consumption driven, like widgets for news, weather, jobs (c) interaction driven, like videos, slideshows, micro-documents, spreadsheet snapshots and (d) submissions like search forms, data-capture fields, etc.

The micro-content in large part is distributed as a code fragment wrapped either in <script>  or an <object>/<embed> tag. As the offering of these services grow, together things will become sophisticated and mature in coming years. How far this script should be trusted? At the onset, the following questions need answering:

  • Can the embedded script read the DOM of the page it is hosted in?
  • Can the script make further calls to the remote server using the script transport?
  • Can the script manipulate the CSS of the page it is hosted in?
  • Can the script attach event handlers?
  • Can the script call window.close() or document.replace() ?
  • Can the script launch a pop-up window while being rendered?
  • Is the script allowed to render non-textual content like video, audio, etc.?

In today’s HTML and the User-Agent world, all the questions may be answered as YES.

The proposal is for a new tag called <sandbox> . <sandbox> provides hints to the user-agent for a fine grained and portable permission control of embedded content. Don’t want the script to capture user events? Only wanna allow page manipulation while being rendered? Say so in the attribute for the element. The proposed tag takes the browser security to a new level. The hints in the sandbox tag would inform the user-agent what the embedded script can/can’t do.

The IDL may look like this:

interface HTMLSandboxElement : HTMLElement {

readonly attribute allowRemoting;

readonly attribute allowStyleChange;

readonly attribute allowDOMScripting;

readonly attribute allowEventHandler;

readonly attribute allowSubmit;

boolean checkPermission(in DOMString attributeName);

}

A sample HTML fragment (Web-Analytics example)

<sandbox allowRemoting="0" allowStyleChange="0"

allowEventHandler="1" allowSubmit="0">

<script src="http://www.example-analytics.com/tracker.js" mce_src="http://www.example-analytics.com/tracker.js" >

</script>

<script type="text/javascript">

_uacct = "UA-XXXXX";

Tracker();

</script> 

</sandbox>

Another example HTML fragment (news widget in sidebar). By default allows content which is plain HTML with links, text and associated styles.

<sandbox>

<script src="http://example.com/dailyheadlines.js" mce_src="http://example.com/dailyheadlines.js"

</script>

</sandbox>

Benefits:

  • Fine-grained control while composing content (or application output) from multiple sources
  • Shared responsibility between page author and user-agent
  • Takes the browser security to a new level
  • Portable permissions instead of relying on individual user-agent configuration options for various permutations and combinations.

Under what circumstances the new tag may not make sense:

  • User-agents take full resposibility of such fine grained permissions through their own implementations and user configuration options
  • Micro-content, content inclusion etc. become passé

A Propusal for A New Pseudo Element Called :icon

Take a look to this HTML5 code as shown here:

<menu type="toolbar">
	<command type="radio" radiogroup="alignment" checked="checked"
		label="Left" icon="icons/alL.png" onclick="setAlign('left')">
	<command type="radio" radiogroup="alignment"
		label="Center" icon="icons/alC.png" onclick="setAlign('center')">
	<command type="radio" radiogroup="alignment"
		label="Right" icon="icons/alR.png" onclick="setAlign('right')">
<hr>
	<command type="command" disabled label="Publish" icon="icons/pub.png" onclick="publish()">
</menu>

The question is: Isn’t icon="" attribute here a presentation attribute?
You might say yes, and it should be set using CSS like this:

command.align-right{icon: '....'}

However, this presentation attribute in turn needs presentation attributes! (position, padding…).

So, we need something in between: A Pseudo Element.
A Pseudo Element is simply an attribute has attributes.

<command class="page-about"...></command>
<command class="domain-settings"...></command>

.page-about:icon {
	content: char(ℹ);
	font: 10pt RichStyle;
	icon-position: top;
}

.domain-settings:icon {
	content: char(⚙);
	font: 10pt RichStyle;
	icon-position: top;
}

Thus, icon="" as an HTML attribute for <command> should be deprecated.

The Shameless Plug Tag

Particularly with the rise in self promotional activities around Social Networks there is a need for a self promotional meta tag – distinct from factual content descriptive meta tags.

<meta name=”shameless” content=”Insert Shameless Plug Here”</>

<shameless>Insert Shameless Plug Here</shameless>

When A Form Should Start Validation?

Let’s take a look to this simple demo form:
http://www.richstyle.org/demo-form.html

I use the following code to style the validation issue:

input:required + output::after,
textarea:required + output::after { content: '*'; }

input:invalid + output::after,
textarea:invalid + output::after { content: '⨉';color: maroon }

input:valid + output::after,
textarea:valid + output::after { content: '✓';color: green }

The only thing looks unacceptable, is that the form validation process starts just when the form is loaded, whilst, it’s much better to start it in each input field independently, as user starts write something in it.

So, I thought of inventing a new attribute called “start-validation” with the following values:

form {
	start-validation: on-load | on-focus | on-type | on-blur | on-submit;
}

Let’s free A and HREF!

Take a look to this example:

<nav class="toolbar">
<ul>
	<li><a herf="index.html">Home</a></li>
	<li><a href="about.html">About</a></li>
	<li><a href="downloads.html">Downloads</a></li>
	<li><a href="contact.html">Contact</a></li>
	<li><a href="javascript:bookmark()">Bookmark</a></li>
</ul>
</nav>

Isn’t better if it was possible to be written like this:

<toolbar>
	<li herf="index.html">Home</li>
	<li href="about.html">About</li>
	<li href="downloads.html">Downloads</li>
	<li href="contact.html">Contact</li>
	<li href="javascript:bookmark()">Bookmark</li>
</toolbar>

or even:

<toolbar>
	<command herf="index.html">Home</command>
	<command href="about.html">About</command>
	<command href="downloads.html">Downloads</command>
	<command href="contact.html">Contact</command>
	<command href="javascript:bookmark()">Bookmark</command>
</toolbar>

I mean why should I have to add <a> tag to every object/tag I want to link to something? Isn’t better if I were able to add href="" attribute to this object/tag without using <a> tag?

Why don’t we use href="" as a global attribute?

Likewise, think of using <a> tag without href="" when the link name = the link address:

<p>
.., you can download it from <a>http://example.com/downloads/</a>.
</p>

instead of:

<p>
.., you can download it from <a href="http://example.com/downloads/">http://example.com/downloads/</a>.
</p>

A Unified Naming Attribute for Everything

Hi all,

I’m glad to participate with the first post in this group :)

Has anyone thought of using label="" as a unified naming attribute; as an alternative to all naming tags and attributes:

<caption> , <label>, <legend>, alt="", for="", title="", summary="".

title="" attribute could be deprecated in favor of a CSS attribute called title: with the following values:

{ title: attr(label) | attr(accesskey) | attr(label) attr(accesskey) | none }

The typical way for label="" presentation is to use :before and :after pseudo elements; beside the title: CSS attribute.