Book Image

Learning Dart, Second Edition - Second Edition

By : Ivo Balbaert
Book Image

Learning Dart, Second Edition - Second Edition

By: Ivo Balbaert

Overview of this book

Table of Contents (18 chapters)
Learning Dart Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Finding elements and changing their attributes


All web applications import the dart:html Dart library; this is a huge collection of functions and classes needed to program the DOM (look it up at api.dartlang.org). Let's discuss the base classes, which are as follows:

  • The Navigator class contains information about the browser running the app, such as the product (the name of the browser), its vendor, the MIME type supports the installed plugins, and also the geolocation object.

  • Every browser window corresponds to an object of the Window class, which contains, among many others, a navigator object, the close, print, scroll, and moveTo methods, and a whole bunch of event handlers, such as onLoad, onClick, onKeyUp, onMouseOver, onTouchStart, and onSubmit. Use an alert to get a pop-up message in the web page, such as in todo_v2.dart:

       window.onLoad.listen( (e) =>       window.alert("I am at your disposal") );    
  • If your browser has tabs, each tab will open in a separate window. From the Window...