×
Namespaces

Variants
Actions

Archived:Use prototype JavasSript library - basic operations (utility functions, etc) in Symbian Web Runtime

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Code ExampleCompatibility
Platform(s):
S60 3rd Edition FP2
Article
Created: dougcn (19 Mar 2008)
Last edited: hamishwillee (02 Jul 2012)


Contents

Introdution

As you may know, Prototype is a famous cross-web-browser javascript library. It supports almost all current popular web browsers, such as FireFox, Safari, IE, Opera, etc. With the latest version(Prototype 1.6.0), it also supports AppleWebKit, an open source web engine provided by Apple Inc.

The Nokia Web Browser is built upon S60WebKit, a port of the open source WebKit project to the S60 platform. Nokia WRT(Web-RunTime) is based on it.

In this section, we will see how to do basic operations(utility functions) using prototype library[1].

Basic operations (Utility functions, etc)

Here is a list of the basic operations (dollar functions) provided by prototype library:

  • $() -- returns the element that has the id passed as an argument
  • $$() -- returns the elements that match CSS selectors
  • $A() -- converts the single argument it receives into an Array object.
  • $F() -- returns the value of any field input control
  • $H() -- converts objects into enumerable Hash objects that resemble associative arrays
  • $R() -- builds a range object.
  • $w() -- Splits a string into an Array, treating all whitespace as delimiters. Equivalent to Ruby's %w{foo bar} or Perl's qw(foo bar).

For detailed explanations of these functions, please go to http://prototypejs.org/api/utility

All of the above functions are tested in the example WRT application of this topic. For the convenience, the related source code of each test case is displayed in UI, and formatted by prettyprint.js for a better look.

All test cases of the above functions passed. The Try.these function is not tested, you can try it yourself.

Most of the examples(cases) come from this guidance: http://www.sergiopereira.com/articles/prototype.js.html (You may notice this guide is a note for prototype1.5.0, but it doesn't matter.)

The next topic will be String manipulations.

Download Sample Widget

Download sample wiget of this topic: File:PrototypeBasicDemo.zip. To install it, just rename the suffix .zip to .wgz.

For the latest version, please go to http://code.google.com/p/prototypewrt/downloads/list

Related topics

References

  • Prototype javascript Home Page [2]
  • Use prototype [3]
  • Sample WRT applications Download [4]
This page was last modified on 2 July 2012, at 07:15.
66 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×