Mobile HTML5

7 downloads 14499 Views 7MB Size Report
Nov 12, 2013 ... Media, Inc. Mobile HTML5, the image of a Racket-tailed Drongo, and ..... You can test all the examples in this book on Windows, Unix, Android.
Want to read more? You can buy this book at oreilly.com in print and ebook format. Buy 2 books, get the 3rd FREE! Use discount code: OPC10 All orders over $29.95 qualify for free shipping within the US.

It’s also available at your favorite book retailer, including the iBookstore, the Android Marketplace, and Amazon.com.

Spreading the knowledge of innovators

oreilly.com

Mobile HTML5 by Estelle Weyl Copyright © 2014 Estelle Weyl. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or [email protected].

Editors: Simon St. Laurent and Meghan Blanchette Production Editor: Kristen Brown Copyeditor: Kiel Van Horn Proofreaders: Troy Mott and Jasmine Kwityn November 2013:

Indexer: Lucie Haskins Cover Designer: Randy Comer Interior Designer: David Futato Illustrator: Rebecca Demarest

First Edition

Revision History for the First Edition: 2013-11-12:

First release

See http://oreilly.com/catalog/errata.csp?isbn=9781449311414 for release details. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Mobile HTML5, the image of a Racket-tailed Drongo, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐ mark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.

ISBN: 978-1-449-31141-4 [LSI]

Table of Contents

Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Native Applications Versus Web Applications What’s New(t)? New Elements and APIs What’s New in CSS? Mobile-Specific Considerations Why This Book? What’s in This Book Conventions Used in This Book Using Code Examples Safari® Books Online How to Contact Us Acknowledgments

xii xvii xix xx xx xxii xxiii xxiii xxiv xxiv xxv

1. Setting the Stage to Learn Mobile HTML5, CSS3, and JavaScript APIs. . . . . . . . . . . . . . . . 1 CubeeDoo: HTML5 Mobile Game Development Tools Text Editor Browser Debugging Tools Desktop Debuggers Remote Debugging Testing Tools Emulators and Simulators Online Tools Phones Automated Testing

2 4 4 5 5 6 8 15 15 17 18 20

2. Upgrading to HTML5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 HTML5 Syntax Elements

24 24 iii

Attributes Global and Internationalization Attributes HTML 4 Attributes Made Core in HTML5 New to HTML5: Global Accessibility and Interactive Attributes HTML Element/Attribute Syntax Self-Closing Elements Best Practices The Required Components Elements Found in the : Adding Metadata Mobile Meta Tags Mobile Vendor-Specific Values The of Your Web Page s Aren’t Just for Stylesheets

25 26 29 31 35 37 38 39 44 45 47 49 50 51

3. Elements That Are New in HTML5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Sectioning Elements in HTML5
Versus