Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

580 CHAPTER 15 Local data with web storage



  1. Correct answer: D
    A. Incorrect: Web storage does not support indexing.
    B. Incorrect: Web storage does not support transactions.
    C. Incorrect: Web storage does not support asynchronous processing.
    D. Correct: The simple key/value pair storage’s easy-to-use interface is perhaps the
    best feature of web storage.


Lesson 2



  1. Correct answer: C
    A. Incorrect: Storage events have an oldValue property that contains original values
    when an entry is updated or removed.
    B. Incorrect: Storage events have a key property that contains the name of the entry
    being added, updated, or deleted.
    C. Correct: There is no property on storage events called changeType.
    D. Incorrect: Storage events have a storageArea property that contains either the
    localStorage or sessionStorage collection that was changed.

  2. Correct answer: C
    A. Incorrect: Session storage events do not go beyond the active tab; other tabs
    would not be notified when changes occur.
    B. Incorrect: Session storage events do not reach outside their current window.
    C. Correct: In this case, an iframe could receive change notifications.
    D. Incorrect: Session storage events do not go beyond the active tab; the operating
    system would not be notified when changes occur.

  3. Correct answer: D
    A. Incorrect: The event.returnValue = false; method is a fairly common way to cancel
    many events after they start, but storage events cannot be canceled.
    B. Incorrect: The event.preventDefault(); method is another way to cancel many
    types of events, but storage events cannot be canceled.
    C. Incorrect: Storage events do not bubble up, so the event.stopPropagation();
    method would have no effect.
    D. Correct: Storage events cannot be canceled after they have been triggered.

Free download pdf