Prototype

From WebOS101

Jump to: navigation, search

Template:Stub

Contents

Overview

Prototype[1] is the core JavaScript library upon which Mojo is built. It works by extending the built-in methods and language constructs of JavaScript to provide more functionality with less code.

Issues

Not all of Prototype is supported in WebOS. Following is a list of Prototype extensions you should not use:

$()

Basically just a short version of document.getElementById, you should use Mojo.Controller.SceneController.get instead. From within your Scene Assistant it should look like:
this.controller.get('someElementIdHere');

The reason being, that document.getElementById is actually window.document.getElementById and when dealing with multi-stage applications, the DOM element 'window' may or may-not exist at any given time.

References

  1. http://www.prototypejs.org
Personal tools