Tag Archive: HTML

Nov
14
2011

Dart and HTML Elements. Part 3

This post is a continuation of our two previous articles, if you do not understand something, maybe you should consult they (Part 1, Part 2). It’s inspired on the Chris Buckett’s example.

We will create a simple form to collect name and surname and greet to our visitors. We will create the form dynamically using constructors. We will use an event to capture the button clicked event and we will show a text into a div for our greeting.

This is the structure of the example:

client/client.html – Page with reference to our script, nothing more.

Read the rest of this entry »

Permanent link to this article: http://www.dartexperience.com/en/2011/11/14/dart-and-html-elements-part-3/

Nov
07
2011

Dart and HTML elements. Part 2

We return to our articles on how Dart treats HTML elements. We will see collections, constructors and events. (See Part 1)

3.- Collections

Objects returned by elements, nodes y query() that correspond to implementations of collecions will be Dart collections. They will be Dart lists, maps y sets.

Instead of a bunch of different methods, are all part of Dart attributes map, easier to treat and remember.

// Javascript:                       // Dart:
elem.hasAttribute('name');           elem.attributes.contains('name');
elem.getAttribute('name');           elem.attributes['name'];
elem.setAttribute('name', 'value');  elem.attributes['name'] = 'value';
elem.removeAttribute('name');        elem.attributes.remove('name');

Read the rest of this entry »

Permanent link to this article: http://www.dartexperience.com/en/2011/11/07/dart-and-html-elements-part-2/

Nov
01
2011

Dart and HTML elements. Part 1

How does Dart interact withHTML elements?

Many of you may wonder where is the HTMLcomponent Dart. How I can access HTMLelements as javascript does?

In the article Improving the DOM by Bob Nystrom en Dartlang explain how they created the system to perform these tasks.

Let’s see.

Read the rest of this entry »

Permanent link to this article: http://www.dartexperience.com/en/2011/11/01/dart-y-elementos-html-parte-1/