Labs/Jetpack/JEP/12: Difference between revisions
Jump to navigation
Jump to search
(Created page with '{{draft}} == JEP 12 - jetpack.selection == * Champion: Aza Raskin <aza at mozilla dot com> * Status: Implementing * Type: API Track * Created: 24 June 2009 * Reference Implemen...') |
|||
Line 24: | Line 24: | ||
Getting and setting the selection live in a family of getters and setters, dependent on the format. | Getting and setting the selection live in a family of getters and setters, dependent on the format. | ||
''' | '''Setting the selection''' | ||
<pre class="brush:js;toolbar:false;"></pre> | <pre class="brush:js;toolbar:false;"> | ||
jetpack.selection.text = "Hello"; | |||
jetpack.selection.html = "<b>Hello</b>"; | |||
var span = document.span("img"); | |||
span.innerHTML = "Grub!"; | |||
jetpack.selection.html = span;</pre> |
Revision as of 02:05, 25 June 2009
JEP 12 - jetpack.selection
- Champion: Aza Raskin <aza at mozilla dot com>
- Status: Implementing
- Type: API Track
- Created: 24 June 2009
- Reference Implementation: jetpack.future.import("selection")
- JEP Index
Introduction and Rationale
Performing a selection is one of fundamental computer-human interactions, acting as a close proxy for a users locus of attention. Even at the time of the writing of this JEP, numerous Jetpacks have already implemented disparate ways of getting and detecting selections.
Jetpacks should be able to set, get, and listen for selection events.
Proposal
The functions to manipulate and access the selection lives in jetpack.selection
.
Getting and Setting
Getting and setting the selection live in a family of getters and setters, dependent on the format.
Setting the selection
jetpack.selection.text = "Hello"; jetpack.selection.html = "<b>Hello</b>"; var span = document.span("img"); span.innerHTML = "Grub!"; jetpack.selection.html = span;