undomanager.html
author Ryosuke Niwa <rniwa@webkit.org>
Tue, 29 May 2012 23:19:44 -0700
changeset 7 44f10659a665
parent 6 ac6ab5cf2890
child 8 17a725399127
permissions -rwxr-xr-x
Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
The disconnected undo manager is essentially immutable and throws INVALID_ACCESS_ERR on transact, undo, redo, clearUndo, and clearRedo.
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
     1
<!DOCTYPE html><head>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
     2
<meta content="text/html; charset=utf-8" http-equiv=content-type>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
     3
<title>UndoManager and DOM Transaction</title>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
     4
<link href=http://www.whatwg.org/style/specification rel=stylesheet type=text/css>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
     5
</head>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
     6
<body class=draft>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
     7
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
     8
<div class=head>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
     9
<h1>UndoManager and DOM Transaction</h1>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    10
2
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
    11
<h2 class="no-num no-toc" id="editor's-draft-&mdash;-29-may-2012">Editor's draft &mdash; 29 May 2012</h2>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    12
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    13
<dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    14
<dt>Editor:</dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    15
<dd>Ryosuke Niwa &lt;<a href=mailto:rniwa@webkit.org>rniwa@webkit.org</a>&gt;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    16
</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    17
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    18
<dt>Acknowledgements</dt>
2
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
    19
<dd>Anne van Kesteren, Annie Sullivan, Alex Russell, Alex Vincent, Aryeh Gregor, Ehsan Akhgari, Eric Uhrhane,
6
ac6ab5cf2890 Add the forgotten undomanager.html change
Ryosuke Niwa <rniwa@webkit.org>
parents: 4
diff changeset
    20
Frederico Caldeira Knabben, Ian Hickson, Johan "Spocke" S&ouml;rlin, Jonas Sicking, Ojan Vafai, Olli Pettay, Sukolsak Sakshuwong</dd>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    21
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    22
<dt>Latest version:</dt>
3
7b82412b9af9 Changed the latest version's URL to http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html.
Ryosuke Niwa <rniwa@webkit.org>
parents: 2
diff changeset
    23
<dd><a href=http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html>
7b82412b9af9 Changed the latest version's URL to http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html.
Ryosuke Niwa <rniwa@webkit.org>
parents: 2
diff changeset
    24
http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html</a></dd>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    25
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    26
<dt>Previous versions:</dt>
2
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
    27
<dd><a href=http://rniwa.com/editing/undomanager-2011-03-27.html>
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
    28
http://rniwa.com/editing/undomanager-2011-03-27.html</a></dd>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    29
<dd><a href=http://rniwa.com/editing/undomanager-2011-12-01.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    30
http://rniwa.com/editing/undomanager-2011-12-01.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    31
<dd><a href=http://rniwa.com/editing/undomanager-2011-11-29.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    32
http://rniwa.com/editing/undomanager-2011-11-29.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    33
<dd><a href=http://rniwa.com/editing/undomanager-2011-10-27.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    34
http://rniwa.com/editing/undomanager-2011-10-27.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    35
<dd><a href=http://rniwa.com/editing/undomanager-2011-10-20.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    36
http://rniwa.com/editing/undomanager-2011-10-20.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    37
<dd><a href=http://rniwa.com/editing/undomanager-2011-10-09.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    38
http://rniwa.com/editing/undomanager-2011-10-09.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    39
<dd><a href=http://rniwa.com/editing/undomanager-2011-09-11.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    40
http://rniwa.com/editing/undomanager-2011-09-11.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    41
<dd><a href=http://rniwa.com/editing/undomanager-2011-08-30.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    42
http://rniwa.com/editing/undomanager-2011-08-30.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    43
<dd><a href=http://rniwa.com/editing/undomanager-2011-08-09.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    44
http://rniwa.com/editing/undomanager-2011-08-09.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    45
<dd><a href=http://rniwa.com/editing/undomanager-2011-08-08.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    46
http://rniwa.com/editing/undomanager-2011-08-08.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    47
<dd><a href=http://rniwa.com/editing/undomanager-2011-07-26.html>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    48
http://rniwa.com/editing/undomanager-2011-07-26.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    49
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    50
<dt>Use cases:</dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    51
<dd><a href=http://wiki.whatwg.org/wiki/UndoManager_Problem_Descriptions>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    52
http://wiki.whatwg.org/wiki/UndoManager_Problem_Descriptions</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    53
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    54
</dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    55
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    56
</div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    57
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    58
<h2 class="no-num no-toc" id=status>Status</h2>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    59
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    60
<p>This document is an early proposal of the specification for Undo Manager and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    61
DOM transaction. This specification will replace the <a href=http://www.whatwg.org/specs/web-apps/current-work/#undomanager>UndoManager</a> section
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    62
of the main <a href=http://www.whatwg.org/html>HTML</a> specification.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    63
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    64
<h2 class="no-num no-toc" id=table-of-contents>Table of Contents</h2>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    65
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    66
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    67
<!--begin-toc-->
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    68
<ol class=toc>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    69
 <li><a href=#introduction><span class=secno>1 </span>Introduction</a></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    70
 <li><a href=#undo-scope-and-undo-manager><span class=secno>2 </span>Undo Scope and Undo Manager</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    71
  <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    72
   <li><a href=#definitions><span class=secno>2.1 </span>Definitions</a></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    73
   <li><a href=#scoping-undo-transaction-history><span class=secno>2.2 </span>Scoping Undo Transaction History</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    74
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    75
     <li><a href=#undo-scope-and-contenteditable><span class=secno>2.2.1 </span>Undo scope and contenteditable</a></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    76
     <li><a href=#undoscope-idl-attribute><span class=secno>2.2.2 </span>undoScope IDL attribute</a></ol></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    77
   <li><a href=#the-undomanager-interface><span class=secno>2.3 </span>The <code>UndoManager</code> interface</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    78
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    79
     <li><a href=#undomanager-idl-attribute><span class=secno>2.3.1 </span>undoManager IDL attribute</a></ol></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    80
   <li><a href=#undo:-moving-forward-in-the-undo-transaction-history><span class=secno>2.4 </span>Undo: moving forward in the undo transaction history</a></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    81
   <li><a href=#redo:-moving-backward-in-the-undo-transaction-history><span class=secno>2.5 </span>Redo: moving backward in the undo transaction history</a></ol></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    82
 <li><a href=#dom-transaction-and-dom-changes><span class=secno>3 </span>DOM Transaction and DOM changes</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    83
  <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    84
   <li><a href=#mutations-of-dom><span class=secno>3.1 </span>Mutations of DOM</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    85
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    86
     <li><a href=#reverting-dom-changes><span class=secno>3.1.1 </span>Reverting DOM changes</a></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    87
     <li><a href=#reapplying-dom-changes><span class=secno>3.1.2 </span>Reapplying DOM changes</a></ol></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    88
   <li><a href=#the-domtransaction-interface><span class=secno>3.2 </span>The <code>DOMTransaction</code> interface</a></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    89
   <li><a href=#automatic-dom-transactions><span class=secno>3.3 </span>Automatic DOM transactions</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    90
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    91
     <li><a href=#automatic-transactions-and-manual-dom-changes><span class=secno>3.3.1 </span>Automatic transactions and manual DOM changes</a></ol></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    92
   <li><a href=#manual-dom-transactions><span class=secno>3.4 </span>Manual DOM transactions</a></ol></li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    93
 <li><a href=#transaction,-undo,-and-redo-events><span class=secno>4 </span>Transaction, Undo, and Redo Events</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    94
  <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    95
   <li><a href=#the-domtransactionevent-interface><span class=secno>4.1 </span>The <code>DOMTransactionEvent</code> interface</a></ol></ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    96
<!--end-toc-->
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    97
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    98
<h2 id=introduction><span class=secno>1 </span>Introduction</h2>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    99
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   100
    <p>This specification defines the API to manage user agent's <a href=#undo-transaction-history>undo transaction history</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   101
    (also known as <dfn id=undo-stack>undo stack</dfn>) and make objects that can be managed by
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   102
    the <a href=#undo-transaction-history>undo transaction history</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   103
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   104
    <p>Many rich text editors on the Web add editing operations that are not natively supported by execCommand and other Web APIs.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   105
    For example, many editors make modifications to DOM after an user agent executed user editing actions to work-around user agent bugs
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   106
    and to customize for their use.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   107
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   108
    <p>However, doing so breaks user agent's native undo and redo because the user agent cannot undo DOM modifications made by scripts.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   109
    This forces the editors to re-implement undo and redo entirely from scratch, and many editors, indeed, store innerHTML as string and recreate
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   110
    the entire editable region whenever a user tires to undo and redo. This is very inefficient and has limited the depth of their <a href=#undo-stack>undo stack</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   111
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   112
    <p>Also, any Web app that tries to mix contenteditable region or text fields with canvas or other non-text editable regions will have to
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   113
    reimplement undo and redo of contenteditable regions as well because the user agent typically has one <a href=#undo-transaction-history>undo transaction history</a> per document,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   114
    and there is no easy way to add new undo entry to the user agent's native <a href=#undo-transaction-history>undo transaction history</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   115
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   116
    <p>This specification tries to address above issues by providing ways to define <a href=#undo-scope>undo scopes</a>, add items to user agent's native
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   117
    <a href=#undo-transaction-history>undo transaction history</a>, and create a sequence of <a href=#dom-changes>DOM changes</a> that can be automatically undone or redone
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   118
    by user agents.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   119
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   120
<h2 id=undo-scope-and-undo-manager><span class=secno>2 </span>Undo Scope and Undo Manager</h2>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   121
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   122
<h3 id=definitions><span class=secno>2.1 </span>Definitions</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   123
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   124
    <p>The user agent must associate an <dfn id=undo-transaction-history>undo transaction history</dfn>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   125
    a list of sequences of <a href=#dom-transaction>DOM transactions</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   126
    with each <code><a href=#undomanager>UndoManager</a></code> object.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   127
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   128
    <p>The <a href=#undo-transaction-history>undo transaction history</a> has an <dfn id=undo-position>undo position</dfn>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   129
    This is the position between two entries in the <a href=#undo-transaction-history>undo transaction history</a>'s list where the next
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   130
    entry represents what needs to happen when <a href=#undo>undo</a> is done,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   131
    and the previous entry represents what needs to happen when <a href=#redo>redo</a> is done.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   132
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   133
    <p>The <dfn id=undo-scope title=undo-scope>undo scope</dfn> is the collection of DOM nodes that are managed by the same <code><a href=#undomanager>UndoManager</a></code>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   134
    A document node or an element with <code><a href=#attr-undoscope>undoscope</a></code> attribute that is either an <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editing-host>editing host</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   135
    or not <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editable>editable</a> defines a new <a href=#undo-scope>undo scope</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   136
    and all descendent nodes of the element, excluding elements with and descendent nodes of elements with <code><a href=#attr-undoscope>undoscope</a></code> attribute,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   137
    will be managed by a new <code><a href=#undomanager>UndoManager</a></code>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   138
    An <dfn id=undo-scope-host>undo scope host</dfn> is a document, or an element with <code><a href=#attr-undoscope>undoscope</a></code> attribute that is either
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   139
    an <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editing-host>editing host</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   140
    or not <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editable>editable</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   141
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   142
<h3 id=scoping-undo-transaction-history><span class=secno>2.2 </span>Scoping Undo Transaction History</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   143
    <p>The <dfn id=attr-undoscope title=attr-undoscope><code>undoscope</code></dfn> attribute is a
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   144
    <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#boolean-attribute>boolean attribute</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   145
    that controls the default <a href=#undo-scope>undo scope</a> of an element. It is to separate <a href=#undo-transaction-history>undo transaction histories</a> of multiple editable regions without scripts.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   146
    Using <code><a href=#attr-undoscope>undoscope</a></code> content attribute, authors can easily set text fields in a widget to have a separate <a href=#undo-transaction-history>undo transaction histories</a> for example.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   147
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   148
    <p>When the <code><a href=#attr-undoscope>undoscope</a></code> content attribute is added to an <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editing-host>editing host</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   149
    or an element that is not <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editable>editable</a>, the user agent must define new <a href=#undo-scope>undo scope</a> for the element,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   150
    and create a new <code><a href=#undomanager>UndoManager</a></code> to manage any <a href=#dom-changes>DOM changes</a> made to all descendent nodes of
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   151
    the element excluding <a href=#undo-scope-host>undo scope hosts</a> and their descendents.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   152
    
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   153
    <p>When the <code><a href=#attr-undoscope>undoscope</a></code> content attribute is removed from an <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editing-host>editing host</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   154
    or an element that is not <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editable>editable</a>, the user agent must remove all entries in the <a href=#undo-transaction-history>undo transaction history</a>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   155
    of the corresponding <a href=#undo-scope>undo scope</a> without <a href=#dom-transaction-unapply>unapplying</a> or <a href=#dom-transaction-reapply>reapplying</a> them and
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   156
    <a href=#disconnect-undomanager>disconnect</a> the corresponding <code><a href=#undomanager>UndoManager</a></code> for the scope.
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   157
    After the removal, the node from which the content attribute is removed and their descendent nodes, excluding <a href=#undo-scope-host>undo scope hosts</a> and their descendents,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   158
    belong to the <a href=#undo-scope>undo scope</a> of the closest ancestor with
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   159
    the <code><a href=#attr-undoscope>undoscope</a></code> content attribute or of the document.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   160
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   161
<h4 id=undo-scope-and-contenteditable><span class=secno>2.2.1 </span>Undo scope and contenteditable</h4>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   162
    <p><code><a href=http://www.whatwg.org/specs/web-apps/current-work/#attr-contenteditable>contenteditable</a></code> content attribute does not define a new <a href=#undo-scope>undo scope</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   163
    and all <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editing-host>editing hosts</a> share the same <code><a href=#undomanager>UndoManager</a></code> by default.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   164
    And the <code><a href=#attr-undoscope>undoscope</a></code> content attribute on an <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editable>editable</a> element is ignored.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   165
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   166
    <p>When the <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#contenteditable>contenteditable</a></code> content attribute is added to an element,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   167
    the user agent must remove all entries in the <a href=#undo-transaction-history>undo transaction histories</a> of the editable <a href=#undo-scope>undo scope hosts</a> that are descendent of the element
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   168
    and have become <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#editable>editable</a> without <a href=#dom-transaction-unapply>unapplying</a> or <a href=#dom-transaction-reapply>reapplying</a> the entries
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   169
    and <a href=#disconnect-undomanager>disconnect</a> the corresponding <code><a href=#undomanager>UndoManager</a></code>s
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   170
    as if the <code><a href=#attr-undoscope>undoscope</a></code> content attribute was removed from all descendent nodes
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   171
    excluding <a href=#undo-scope-host>undo scope hosts</a> and their descendents.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   172
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   173
    <p>Conversely, when the <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#contenteditable>contenteditable</a></code> content attribute is removed from an element,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   174
    the user agent must define new <a href=#undo-scope>undo scope</a> for each descendent element with the <code><a href=#attr-undoscope>undoscope</a></code> content attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   175
    and create a new <code><a href=#undomanager>UndoManager</a></code> to manage any <a href=#dom-changes>DOM changes</a> made to descendents of each element,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   176
    excluding <a href=#undo-scope-host>undo scope hosts</a> and their descendents, as if the <code><a href=#attr-undoscope>undoscope</a></code> content attribute was re-added to descendent elements with
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   177
    the <code><a href=#attr-undoscope>undoscope</a></code> content attribute.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   178
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   179
<h4 id=undoscope-idl-attribute><span class=secno>2.2.2 </span>undoScope IDL attribute</h4>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   180
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   181
    <pre class=idl>partial interface <a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614>Element</a> {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   182
    attribute boolean <a href=#dom-undoscope>undoScope</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   183
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   184
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   185
        <dt><var title="">element</var> . <code title=dom-undoScope><a href=#dom-undoscope>undoScope</a></code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   186
        <dd><p>Returns <code>true</code> if the element is an undo scope host and <code>false</code> otherwise.</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   187
    </dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   188
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   189
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   190
        <p>The <dfn id=dom-undoscope><code>undoScope</code></dfn> IDL attribute of <code><a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614>Element</a></code> interfaces must <a href=http://www.whatwg.org/specs/web-apps/current-work/complete/common-dom-interfaces.html#reflecting-content-attributes-in-idl-attributes>reflect</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   191
        the <code><a href=#attr-undoscope>undoscope</a></code> content attribute.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   192
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   193
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   194
<h3 id=the-undomanager-interface><span class=secno>2.3 </span>The <code><a href=#undomanager>UndoManager</a></code> interface</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   195
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   196
    <p>To manage transaction entries in the undo transaction history, the <code><a href=#undomanager>UndoManager</a></code> interface can be used:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   197
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   198
    <pre class=idl>interface <dfn id=undomanager>UndoManager</dfn> {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   199
    void <a href=#dom-undomanager-transact title=dom-UndoManager-transact>transact</a>(in Object transaction, in boolean merge);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   200
    void <a href=#dom-undomanager-undo title=dom-UndoManager-undo>undo</a>();
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   201
    void <a href=#dom-undomanager-redo title=dom-UndoManager-redo>redo</a>();
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   202
    getter DOMTransaction[] <a href=#dom-undomanager-item title=dom-UndoManager-item>item</a>(in unsigned long index);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   203
    readonly attribute unsigned long <a href=#dom-undomanager-length title=dom-UndoManager-length>length</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   204
    readonly attribute unsigned long <a href=#dom-undomanager-position title=dom-UndoManager-position>position</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   205
    void <a href=#dom-undomanager-clearUndo title=dom-UndoManager-clearUndo>clearUndo</a>();
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   206
    void <a href=#dom-undomanager-clearRedo title=dom-UndoManager-clearRedo>clearRedo</a>();
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   207
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   208
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   209
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   210
        <dt><var title="">document</var> . <code title=dom-undoManager><a href=#dom-undomanager>undoManager</a></code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   211
        <dd><p>Returns the <code><a href=#undomanager>UndoManager</a></code> object.</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   212
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   213
        <dt><var title="">element</var> . <code title=dom-undoManager><a href=#dom-undomanager>undoManager</a></code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   214
        <dd><p>Returns the <code><a href=#undomanager>UndoManager</a></code> object.</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   215
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   216
        <dt><var title="">undoManager</var> . <code title=dom-UndoManager-transact><a href=#dom-undomanager-transact>transact</a>(<var title="">transaction</var>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   217
            <var title="">merge</var>)</code></dt>
2
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
   218
        <dd><p>Clears entries above the current undo position, <a href=#dom-transaction-apply>applies</a> <var title="">transaction</var>,
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
   219
            and adds it to the beginning of the first entry in <a href=#undo-transaction-history>undo transaction history</a><a>,
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
   220
            or of a new </a><a href=#undo-transaction-history>undo transaction history</a><a> if <var title="">merge</var> is set to true.</a></dd><a>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   221
2
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
   222
        </a><dt><a><var title="">undoManager</var> . <code title=dom-UndoManager-undo></code></a><code title=dom-UndoManager-undo><a href=#dom-undomanager-undo>undo</a>()</code></dt>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   223
        <dd><p>Unapplies all <a href=#dom-transaction>DOM transactions</a> in the entry immediately after
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   224
            the current position in the reverse order and increments
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   225
            <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> by 1
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   226
            if <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> &lt;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   227
            <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code>.</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   228
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   229
        <dt><var title="">undoManager</var> . <code title=dom-UndoManager-redo><a href=#dom-undomanager-redo>redo</a>()</code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   230
        <dd><p>Reapplies all <a href=#dom-transaction>DOM transactions</a> in the entry immediately before
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   231
            the current position and decrements <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> by 1
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   232
            if <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> &gt; 0</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   233
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   234
        <dt><var title="">undoManager</var> . <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   235
        <dd><p>Returns the number of the current entry in the <a href=#undo-transaction-history>undo transaction history</a><a>. (Entries at and past this point are redo entries.)</a></dd><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   236
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   237
        </a><dt><a><var title="">undoManager</var> . <code title=dom-UndoManager-length></code></a><code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   238
        <dd><p>Returns the number of entries in the <a href=#undo-transaction-history>undo transaction history</a><a>.</a></dd><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   239
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   240
        </a><dt><a><var title="">data</var> = <var title="">undoManager</var> . <code title=dom-UndoManager-item></code></a><code title=dom-UndoManager-item><a href=#dom-undomanager-item>item</a></code>(<var title="">index</var>)</dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   241
        <dt><var title="">undoManager</var>[<var title="">index</var>]</dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   242
        <dd><p>Returns the entry with index <var title="">index</var> in the <a href=#undo-transaction-history>undo transaction history</a><a>.</a></p><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   243
            <p>Returns null if <var title="">index</var> is out of range.</a></dd><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   244
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   245
        </a><dt><a><var title="">undoManager</var> . <code title=dom-UndoManager-clearundo></code></a><code title=dom-UndoManager-clearundo><a href=#dom-undomanager-clearundo>clearUndo</a>()</code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   246
        <dd><p>Removes entries in the <a href=#undo-transaction-history>undo transaction history</a><a> before
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   247
            <code title=dom-UndoManager-position></code></a><code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   248
            resets <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> to 0.</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   249
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   250
        <dt><var title="">undoManager</var> . <code title=dom-UndoManager-clearredo><a href=#dom-undomanager-clearredo>clearRedo</a>()</code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   251
        <dd><p>Removes entries in the <a href=#undo-transaction-history>undo transaction history</a><a> after
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   252
            <code title=dom-UndoManager-position></code></a><code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code>.</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   253
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   254
    </dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   255
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   256
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   257
        <p><code><a href=#undomanager>UndoManager</a></code> objects represent and manage their node's
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   258
        <a href=#undo-transaction-history>undo transaction history</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   259
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   260
        <p>The object's <a href=http://www.whatwg.org/specs/web-apps/current-work/#supported-property-indices>supported property indices</a> are the
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   261
        numbers in the range zero to <span title=""><var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var>-1</span>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   262
        unless the <var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var> is zero, in which
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   263
        case there are no <a href=http://www.whatwg.org/specs/web-apps/current-work/#supported-property-indices>supported property indices</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   264
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   265
        <p>The <dfn id=dom-undomanager-transact title=dom-UndoManager-transact><code>transact(<var title="">transaction</var>, <var title="">merge</var>)</code></dfn> will</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   266
        <ol>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   267
            <li>If this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   268
                <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   269
                or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, then throw
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   270
                <code class=external><a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR>INVALID_ACCESS_ERR</a></code> and stop.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   271
            <li>Clear all entries between before the current <a href=#undo-position>undo position</a> without <a href=#dom-transaction-unapply>unapplying</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   272
            or <a href=#dom-transaction-reapply>reapplying</a> the <a href=#dom-transaction>transactions</a> in the entires.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   273
            <li><a href=#dom-transaction-apply>Apply</a> the <var title="">transaction</var>.</li>
4
df99f18b2937 Revise the way an entry (a.k.a. "transaction group") in the undo transaction history is added.
Ryosuke Niwa <rniwa@webkit.org>
parents: 3
diff changeset
   274
            <li>If <var title="">merge</var> is set to true, add an empty entry to the beginning of the <a href=#undo-transaction-history>undo transaction history</a>.</li>
df99f18b2937 Revise the way an entry (a.k.a. "transaction group") in the undo transaction history is added.
Ryosuke Niwa <rniwa@webkit.org>
parents: 3
diff changeset
   275
            <li>Add the applied transaction to the beginning of the first entry in the <a href=#undo-transaction-history>undo transaction history</a>.</li>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   276
            <li><a href=#fire-a-dom-transaction-event>Fire a DOM transaction event</a> for the transaction applied in step 3 at the <a href=#undo-scope-host>undo scope host</a>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   277
            of this <code><a href=#undomanager>UndoManager</a></code> if the <code><a href=#undomanager>UndoManager</a></code> had not already been <a href=#disconnect-undomanager>disconnected</a>.</li>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   278
        </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   279
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   280
        <p>The <dfn id=dom-undomanager-undo title=dom-UndoManager-undo><code>undo()</code></dfn> will</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   281
        <ol>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   282
            <li>If this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   283
                <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   284
                or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, then throw
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   285
                <code class=external><a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR>INVALID_ACCESS_ERR</a></code> and stop.</li>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   286
            <li>If <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> &le; <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code>, stop.</li>
4
df99f18b2937 Revise the way an entry (a.k.a. "transaction group") in the undo transaction history is added.
Ryosuke Niwa <rniwa@webkit.org>
parents: 3
diff changeset
   287
            <li>Otherwise, <a href=#dom-transaction-unapply>unapply</a> <a href=#dom-transaction>DOM transactions</a> in the entry immediately after
df99f18b2937 Revise the way an entry (a.k.a. "transaction group") in the undo transaction history is added.
Ryosuke Niwa <rniwa@webkit.org>
parents: 3
diff changeset
   288
            the <a href=#undo-position>undo position</a> in the order and increment <a href=#dom-undomanager-position>position</a> by 1.</li>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   289
            <li><a href=#fire-an-undo-event>Fire an undo event</a> for the transaction unapplied in step 3 at the <a href=#undo-scope-host>undo scope host</a>
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   290
            of this <code><a href=#undomanager>UndoManager</a></code> if the <code><a href=#undomanager>UndoManager</a></code> had not already been <a href=#disconnect-undomanager>disconnected</a>.</li>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   291
        </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   292
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   293
        <p>The <dfn id=dom-undomanager-redo title=dom-UndoManager-redo><code>redo()</code></dfn> will</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   294
        <ol>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   295
            <li>If this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   296
                <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   297
                or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, then throw
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   298
                <code class=external><a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR>INVALID_ACCESS_ERR</a></code> and stop.</li>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   299
            <li>If <code title=dom-UndoManager-position><a href=#dom-undomanager-position>position</a></code> &le; 0, stop.</li>
4
df99f18b2937 Revise the way an entry (a.k.a. "transaction group") in the undo transaction history is added.
Ryosuke Niwa <rniwa@webkit.org>
parents: 3
diff changeset
   300
            <li>Otherwise, <a href=#dom-transaction-reapply>reapply</a> <a href=#dom-transaction>DOM transactions</a> in the entry immediately before
df99f18b2937 Revise the way an entry (a.k.a. "transaction group") in the undo transaction history is added.
Ryosuke Niwa <rniwa@webkit.org>
parents: 3
diff changeset
   301
            the <a href=#undo-position>undo position</a> in the reverse order and decrement <a href=#dom-undomanager-position>position</a> by 1.</li>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   302
            <li><a href=#fire-a-redo-event>Fire a redo event</a> for the transaction unapplied in step 3 at the <a href=#undo-scope-host>undo scope host</a>
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   303
            of this <code><a href=#undomanager>UndoManager</a></code> if the <code><a href=#undomanager>UndoManager</a></code> had not already been <a href=#disconnect-undomanager>disconnected</a>.</li>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   304
        </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   305
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   306
        <p>The <dfn id=dom-undomanager-item title=dom-UndoManager-item><code>item(<var title="">n</var>)</code></dfn>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   307
        method must return a new array representing the <var title="">n</var>th entry in the <a href=#undo-transaction-history>undo transaction history</a> if
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   308
        0 &le; <var>n</var> &le; <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code>, or null otherwise.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   309
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   310
        <p class=note>Being able to access an arbitrary element in the <a href=#undo-transaction-history>undo transaction history</a> is needed to allow scripts to determine
2
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
   311
        whether new DOM transaction and the last DOM transaction should being to the same entry or not.</p>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   312
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   313
        <p>The <dfn id=dom-undomanager-position title=dom-UndoManager-position><code>position</code></dfn>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   314
        attribute must return the index of the <a href=#undo-position>undo position</a> in the <a href=#undo-transaction-history>undo transaction history</a>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   315
        If there are no <a href=#dom-transaction>DOM transaction</a>s to undo, then the value must be same as
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   316
        <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code> attribute.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   317
        If there are no <a href=#dom-transaction>DOM transaction</a>s to redo, then the value must be zero.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   318
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   319
        <p>The <dfn id=dom-undomanager-length title=dom-UndoManager-length><code>length</code></dfn>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   320
        attribute must return the number of entries in the <a href=#undo-transaction-history>undo transaction history</a>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   321
        This is the <var title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></var>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   322
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   323
        <p>The <dfn id=dom-undomanager-clearundo title=dom-UndoManager-clearUndo><code>clearUndo()</code></dfn>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   324
        method must throw <code class=external><a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR>INVALID_ACCESS_ERR</a></code>
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   325
        if this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   326
        <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   327
        or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, 
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   328
        otherwise it must remove all entries in the <a href=#undo-transaction-history>undo transaction history</a> before the <a href=#undo-position>undo position</a>,
4
df99f18b2937 Revise the way an entry (a.k.a. "transaction group") in the undo transaction history is added.
Ryosuke Niwa <rniwa@webkit.org>
parents: 3
diff changeset
   329
        and move the <a href=#undo-position>undo position</a> to the top (set <a href=#dom-undomanager-position>position</a> to zero).</p>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   330
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   331
        <p>The <dfn id=dom-undomanager-clearredo title=dom-UndoManager-clearRedo><code>clearRedo()</code></dfn>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   332
        method must throw <code class=external><a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR>INVALID_ACCESS_ERR</a></code>
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   333
        if this <code><a href=#undomanager>UndoManager</a></code> is already in the process of <a href=#dom-transaction-apply>applying</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   334
        <a href=#dom-transaction-unapply>unapplying</a>, or <a href=#dom-transaction-reapply>reapplying</a> a <a href=#dom-transaction>DOM transaction</a>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   335
        or the <code><a href=#undomanager>UndoManager</a></code> had been <a href=#disconnect-undomanager>disconnected</a>, 
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   336
        otherwise it must remove all entries in the <a href=#undo-transaction-history>undo transaction history</a> after the <a href=#undo-position>undo position</a>.</p>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   337
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   338
        <p><dfn id=the-active-undo-manager>The active undo manager</dfn> is the <code><a href=#undomanager>UndoManager</a></code> of the focused node in the document.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   339
        If no node has focus, then it's assumed to be of the document.</p>
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   340
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   341
        <p>To <dfn id=disconnect-undomanager>disconnect an UndoManager</dfn> means to deprive the ability to add or remove entries in
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   342
        the <a href=#undo-transaction-history>undo transaction history</a> of the <code><a href=#undomanager>UndoManager</a></code>.
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   343
        Once the <code><a href=#undomanager>UndoManager</a></code> is disconnected, <code><a href=#dom-undomanager-transact>transact</a>()</code>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   344
        <code><a href=#dom-undomanager-undo>undo</a>()</code>, <code><a href=#dom-undomanager-redo>redo</a>()</code>, <code><a href=#dom-undomanager-clearundo>clearUndo</a>()</code>,
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   345
        and <code><a href=#dom-undomanager-clearundo>clearRedo</a>()</code> will all throw
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   346
        <code class=external><a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#DOMException-INVALID_ACCESS_ERR>INVALID_ACCESS_ERR</a></code>.<p>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   347
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   348
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   349
    <p>Each entry in the <a href=#undo-manager>UndoManager</a> consists of one or more <a href=#dom-transaction>DOM transactions</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   350
    all of which are <a href=#dom-transaction-unapply>unapplied</a> and <a href=#dom-transaction-reapply>reapplied</a> togehter in one
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   351
    <a href=#undo>undo</a> or <a href=#redo>redo</a>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   352
    </p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   353
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   354
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   355
        <p>Because <code><a href=#dom-undomanager-item>item()</a></code> returns new array on each call,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   356
        modifying the array does not have any effect on the sequence of <a href=#dom-transaction>DOM transactions</a> of the entry,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   357
        and two return values of <code><a href=#dom-undomanager-item>item()</a></code> are alwys different objects.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   358
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   359
        <pre>document.undoManager.transact(...);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   360
document.undoManager.transact(..., true);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   361
document.undoManager.transact(..., true);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   362
alert(document.undoManager.item(0).length); // Alerts 3
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   363
document.undoManager.item(0).pop();
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   364
alert(document.undoManager.item(0).length); // Still alerts 3
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   365
alert(document.undoManager.item(0) === document.undoManager.item(0)); // Alerts false
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   366
</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   367
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   368
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   369
    <p class=note>A typical use case for having multiple <a href=#dom-transaction>DOM transactions</a> in one entry is for typing
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   370
    multiple letters, spaces, and new lines that must be undone or redone in one step.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   371
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   372
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   373
        <p>In the following example, letters "o" and "k" are inserted by two <a href=#automatic-dom-transaction>automatic DOM transactions</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   374
        that form one entry in the <a href=#undo-transaction-history>undo transaction history</a> of the <a href=#undo-manager>UndoManager</a>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   375
        A br element and string "hi" are then inserted by another two <a href=#automatic-dom-transaction>automatic DOM transactions</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   376
        to form entry in the <a href=#undo-transaction-history>undo transaction history</a>. All transactions have the label "Typing".</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   377
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   378
        <pre>// Assume myEditor is some element that has undoscope attribute, and insert(node) is a function that inserts the specified node at where the caret is.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   379
myEditor.undoManager.transact({executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   380
    insert(document.createTextNode('o')); }, label: 'Typing'});
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   381
myEditor.undoManager.transact({executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   382
    insert(document.createTextNode('k')); }, label: 'Typing'}, true);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   383
myEditor.undoManager.transact({executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   384
    insert(document.createElement('br')); }, label: 'Typing'});
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   385
myEditor.undoManager.transact({executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   386
    insert(document.createTextNode('hi')); }, label: 'Typing'}), true);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   387
</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   388
        <p>When the first <a href=#undo>undo</a> is executed immediately after this code is ran, the last two transactions are <a href=#dom-transaction-unapply>unapplied</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   389
        and the br element and string "hi" will be removed from the DOM. The second <a href=#undo>undo</a> will <a href=#dom-transaction-unapply>unapply</a> the first two transactions and remove "o" and "k".</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   390
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   391
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   392
    <p class=note>Because Mac OS X and other frameworks expect applications to provide an array of undo items, simply dispatching undo and redo events
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   393
    and having scripts manage <a href=#undo-transaction-history>undo transaction history</a> would not let the user agent populate the native UI properly.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   394
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   395
<h4 id=undomanager-idl-attribute><span class=secno>2.3.1 </span>undoManager IDL attribute</h4>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   396
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   397
    <pre class=idl>partial interface <a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-745549614>Element</a> {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   398
    attribute <a href=#undomanager>UndoManager</a> <a href=#dom-undomanager>undoManager</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   399
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   400
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   401
        <dt><var title="">element</var> . <code title=dom-undoManager><a href=#dom-undomanager>undoManager</a></code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   402
        <dd><p>Returns the <code><a href=#undomanager>UndoManager</a></code> object associated with the element's <a href=#undo-scope>undo scope</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   403
        if the element is an <a href=#undo-scope-host>undo scope host</a>, or <code>null</code> otherwise.</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   404
    </dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   405
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   406
    <pre class=idl>partial interface <a href=http://www.w3.org/TR/DOM-Level-3-Core/core.html#i-Document>Document</a> {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   407
    attribute <a href=#undomanager>UndoManager</a> <a href=#dom-undomanager>undoManager</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   408
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   409
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   410
        <dt><var title="">document</var> . <code title=dom-undoManager><a href=#dom-undomanager>undoManager</a></code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   411
        <dd><p>Returns the <code><a href=#undomanager>UndoManager</a></code> object associated with the document.</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   412
    </dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   413
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   414
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   415
        <p>The <dfn id=dom-undomanager title=dom-undoManager><code>undoManager</code></dfn> IDL attribute of
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   416
        <code class=external><a href=http://www.whatwg.org/specs/web-apps/current-work/#document>Document</a></code> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   417
        <code class=external><a href=http://www.whatwg.org/specs/web-apps/current-work/#element>Element</a></code> interfaces must return the object implementing
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   418
        the <code><a href=#undomanager>UndoManager</a></code> interface for the <a href=#undo-scope>undo scope</a> if the node is an <a href=#undo-scope-host>undo scope host</a>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   419
        If the node is not an <a href=#undo-scope-host>undo scope host</a>, it must return <code>null</code>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   420
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   421
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   422
<h3 id=undo:-moving-forward-in-the-undo-transaction-history><span class=secno>2.4 </span>Undo: moving forward in the undo transaction history</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   423
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   424
    <p>When the user invokes an undo operation, or when the
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   425
    <code class=external><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#execCommand>execCommand()</a></code> method is called with
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   426
    the undo command, the user agent must perform an <dfn id=undo>undo</dfn> operation on <a href=#the-active-undo-manager>the active undo manager</a> by calling
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   427
    the <code><a href=#dom-undomanager-undo>undo</a>()</code> method.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   428
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   429
<h3 id=redo:-moving-backward-in-the-undo-transaction-history><span class=secno>2.5 </span>Redo: moving backward in the undo transaction history</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   430
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   431
    <p>When the user invokes a redo operation, or when the
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   432
    <code class=external><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#execCommand>execCommand()</a></code> method is called with
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   433
    the redo command, the user agent must perform an <dfn id=redo>redo</dfn> operation on <a href=#the-active-undo-manager>the active undo manager</a> by calling
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   434
    the <code><a href=#dom-undomanager-redo>redo</a>()</code> method.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   435
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   436
<h2 id=dom-transaction-and-dom-changes><span class=secno>3 </span>DOM Transaction and DOM changes</h2>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   437
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   438
    <p>A <dfn id=dom-transaction>DOM transaction</dfn> is an ordered set of <a href=#dom-changes>DOM changes</a> associated with
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   439
    a unique <a href=#undo-scope-host>undo scope host</a> that can be <a href=#dom-transaction-apply>applied</a>, <a href=#dom-transaction-unapply>unapplied</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   440
    or <a href=#dom-transaction-reapply>reapplied</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   441
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   442
    <p>To <dfn id=dom-transaction-apply title=dom-transaction-apply>apply</dfn> a <a href=#dom-transaction>DOM transaction</a> means to make the associated <a href=#dom-changes>DOM changes</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   443
    under the associated <a href=#undo-scope-host>undo scope host</a>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   444
    And to <dfn id=dom-transaction-unapply title=dom-transaction-unapply>unapply</dfn> and to <dfn id=dom-transaction-reapply title=dom-transaction-reapply>reapply</dfn>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   445
    a <a href=#dom-transaction>DOM transaction</a> means, respectively, to revert and to remake the associated <a href=#dom-changes>DOM changes</a> under the associated <a href=#undo-scope-host>undo scope host</a>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   446
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   447
    <p>A <a href=#dom-transaction>DOM transaction</a> can be <a href=#dom-transaction-unapply>unapplied</a> or <a href=#dom-transaction-reapply>reapplied</a> if it appears, respectively, immediately after or immediately before
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   448
    the <a href=#undo-position>undo position</a> in the associated <code><a href=#undomanager>UndoManager</a></code>'s <a href=#undo-transaction-history>undo transaction history</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   449
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   450
<h3 id=mutations-of-dom><span class=secno>3.1 </span>Mutations of DOM</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   451
    <p><dfn id=dom-changes>DOM changes</dfn> of a node is a sequence s<sub>1</sub>, s<sub>2</sub>, ... s<sub>n</sub> where each s<sub>i</sub> with 1 &le; i &le; n is either one of:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   452
    <ul>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   453
        <li><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-insert>Inserting</a> or <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-remove>removing</a> a node under the element.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   454
        <li><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-cd-replace>Replacement of character data</a>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   455
        <li><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attributes-append>Appending</a>, <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attributes-remove>removing</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   456
        or <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attribute-change>changing</a> a content attribute of the element or descendent nodes of the element.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   457
        <li>Setting <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-textarea-element>textarea</a></code> element's
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   458
        <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#dom-textarea-value>value</a></code> IDL attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   459
        or <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element>input</a></code> elment's
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   460
        <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#dom-input-value>value</a></code> IDL attribute.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   461
    </ul>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   462
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   463
    <p>The <dfn id=dom-state>DOM state</dfn> of a node is the state of all descendent nodes and their attributes that are affected by <a href=#dom-changes>DOM changes</a> of the element.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   464
    If two <a href=#dom-states>DOM states</a> of a node are equal, then the node and all its descendent nodes must be identical.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   465
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   466
<h4 id=reverting-dom-changes><span class=secno>3.1.1 </span>Reverting DOM changes</h4>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   467
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   468
    <p>To <dfn id=revert-dom-changes>revert DOM changes</dfn> of the sequence s<sub>1</sub>, s<sub>2</sub>, ... s<sub>n</sub>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   469
    revert each s<sub>i</sub> with 1 &le; i &le; n in the reverse order s<sub>n</sub>, s<sub>n-1</sub>, ... s<sub>1</sub> as specified below:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   470
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   471
    <p>To revert <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-insert>inserting</a> a <var>node</var> into a <var>parent</var> before a <var>child</var>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   472
    run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   473
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   474
        <li>If <var>node</var> is not null and its parent is not <var>parent</var>, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   475
        <li>If <var>child</var> is not null and its parent is not <var>parent</var>, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   476
        <li>If <var>child</var> is not null and its previous sibling is not <var>node</var>, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   477
        <li><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-pre-remove>Pre-remove</a> <var>node</var> from <var>parent</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   478
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   479
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   480
    <p>To revert <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-remove>removing</a> a <var>node</var> from a <var>parent</var>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   481
    let <var>child</var> be the next sibling of <var>node</var> before the removal, and run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   482
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   483
        <li>If <var>node</var> is not null and its parent is not null, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   484
        <li>If <var>child</var> is not null and its parent is not <var>parent</var>, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   485
        <li><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-pre-insert>Pre-insert</a> <var>child</var> into <var>parent</var> before <var>child</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   486
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   487
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   488
    <p>To revert <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-cd-replace>replacing</a> data of a <var>node</var> with an <var>offset</var>, <var>count</var>, and <var>data</var>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   489
    let <var>replacedData</var> be the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-cd-replace>substringed data</a> with <var>node</var>, <var>offset</var>, and <var>count</var> before the replacement,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   490
    and run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   491
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   492
        <li>If node's <code><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-characterdata-length>length</a></code> attribute is less than <var>offset</var>, terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   493
        <li><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-cd-replace>Replace data</a> of <var>node</var> with <var>offset</var>, the length of data, and <var>replacedData</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   494
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   495
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   496
    <p>To revert <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-change>changing</a> an attribute whose
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   497
    <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   498
    <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var> to <var>value</var>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   499
    let <var>oldValue</var> be the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-value>content attribute value</a> before the change,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   500
    <var>oldPrefix</var> be the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace-prefix>namespace prefix</a> before the change,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   501
    and <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-change>change</a> the attribute to <var>oldValue</var>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   502
    and set the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace-prefix>namespace prefix</a> to <var>oldPrefix</var>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   503
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   504
    <p>To revert <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attributes-append>appending</a> an attribute whose
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   505
    <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   506
    <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var> to a node
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   507
    and setting the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace-prefix>namespace prefix</a> to <var>prefix</var>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   508
    run these steps.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   509
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   510
        <li>If a content attribute whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   511
        is <var>namespace</var> and <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   512
        is <var>localName</var> doesn't exist on the node, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   513
        <li>Otherwise, <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attributes-remove>remove</a> the attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   514
        whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   515
        <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   516
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   517
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   518
    <p>To revert <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attributes-remove>removing</a> an attribute whose
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   519
    <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   520
    <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var> from a node,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   521
    let <var>oldValue</var> be the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-value>content attribute value</a> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   522
    <var>oldPrefix</var> be the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace-prefix>namespace prefix</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   523
    both before the removal, and run these steps.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   524
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   525
        <li>If a content attribute whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   526
        is <var>namespace</var> and <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   527
        is <var>localName</var> exists on the node, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   528
        <li>Otherwise, create and append the attribute whose
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   529
        <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   530
        <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   531
        with <var>oldValue</var> as the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-value>content attribute value</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   532
        and set the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace-prefix>namespace prefix</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   533
        to <var>oldPrefix</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   534
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   535
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   536
    <p>To revert setting <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-textarea-element>textarea</a></code>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   537
    element's <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#dom-textarea-value>value</a></code> IDL attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   538
    and <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element>input</a></code> element's
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   539
    <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#dom-input-value>value</a></code> IDL attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   540
    to <var>value</var>, set element's <code>value</code> IDL attribute to
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   541
    the <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#concept-textarea-raw-value>raw value</a> of the textarea element
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   542
    and the <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#concept-fe-value>value</a> of the input element
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   543
    before the setting respectively.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   544
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   545
<h4 id=reapplying-dom-changes><span class=secno>3.1.2 </span>Reapplying DOM changes</h4>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   546
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   547
    <p>To <dfn id=reapply-dom-changes>reapply DOM changes</dfn> of the sequence s<sub>1</sub>, s<sub>2</sub>, ... s<sub>n</sub>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   548
    reapply each s<sub>i</sub> with 1 &le; i &le; n in the same order s<sub>1</sub>, s<sub>2</sub>, ... s<sub>n</sub> as specified below:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   549
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   550
    <p>To reapply <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-insert>inserting</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   551
    a <var>node</var> into a <var>parent</var> before a <var>child</var>, run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   552
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   553
        <li>If <var>node</var> is not null and its parent is not null, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   554
        <li>If <var>child</var> is not null and its parent is not <var>parent</var>, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   555
        <li><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-pre-insert>Pre-insert</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   556
        <var>child</var> into <var>parent</var> before <var>child</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   557
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   558
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   559
    <p>To reapply <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-remove>removing</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   560
    a <var>node</var> from a <var>parent</var>, let <var>child</var> be the next sibling of <var>node</var> before the removal,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   561
    and run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   562
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   563
        <li>If <var>node</var> is not null and its parent is not <var>parent</var>, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   564
        <li>If <var>child</var> is not null and its parent is not <var>parent</var>, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   565
        <li>If <var>child</var> is not null and its previous sibling is not <var>node</var>, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   566
        <li><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-pre-remove>Pre-remove</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   567
        <var>node</var> from <var>parent</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   568
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   569
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   570
    <p>To reapply <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-cd-replace>replacing</a> data
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   571
    of a <var>node</var> with an <var>offset</var>, <var>count</var>, and <var>data</var>, and run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   572
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   573
        <li>If node's <code><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-characterdata-length>length</a></code>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   574
        attribute is less than <var>offset</var>, terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   575
        <li><a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-cd-replace>Replace data</a> of <var>node</var>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   576
        with <var>offset</var>, <var>count</var>, and <var>replacedData</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   577
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   578
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   579
    <p>To reapply <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-change>changing</a> an attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   580
    whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   581
    and <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   582
    to <var>value</var>, let <var>prefix</var> be the
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   583
    <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace-prefix>namespace prefix</a> after the change,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   584
    and change the attribute to <var>value</var> and set
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   585
    the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace-prefix>namespace prefix</a> to <var>prefix</var>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   586
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   587
    <p>To reapply <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attributes-append>appending</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   588
    an attribute whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   589
    and <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   590
    with <var>value</var> as the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-value>content attribute value</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   591
    to a node and setting the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace-prefix>namespace prefix</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   592
    to <var>prefix</var>, run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   593
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   594
        <li>If a content attribute whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   595
        is <var>namespace</var> and <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   596
        <var>localName</var> exists on the node, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   597
        <li>Otherwise, <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attributes-append>append</a> the attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   598
        whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   599
        <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   600
        with <var>value</var> as the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-value>content attribute value</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   601
        to the node, and set <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace-prefix>namespace prefix</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   602
        to <var>prefix</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   603
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   604
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   605
    <p>To reapply <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attributes-remove>removing</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   606
    an attribute whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   607
    and <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   608
    from a node, run these steps.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   609
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   610
        <li>If a content attribute whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   611
        <var>namespace</var> and <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   612
        <var>localName</var> doesn't exist on the node, then terminate these steps.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   613
        <li>Otherwise, <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-element-attributes-remove>remove</a> the attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   614
        whose <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-namespace>namespace</a> is <var>namespace</var> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   615
        <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-attribute-local-name>local name</a> is <var>localName</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   616
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   617
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   618
    <p>To reapply setting <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#the-textarea-element>textarea</a></code>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   619
    element's <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html#dom-textarea-value>value</a></code> IDL attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   620
    or <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element>input</a></code> elment's
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   621
    <code><a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#dom-input-value>value</a></code> IDL attribute
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   622
    to <var>value</var>, set element's <code>value</code> IDL attribute to <var>value</var>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   623
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   624
<h3 id=the-domtransaction-interface><span class=secno>3.2 </span>The <code><a href=#dom-domtransaction>DOMTransaction</a></code> interface</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   625
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   626
    <pre class=idl>[NoInterfaceObject]
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   627
interface <dfn id=dom-domtransaction>DOMTransaction</dfn> {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   628
    attribute DOMString <a href=#dom-domtransaction-label>label</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   629
    attribute <a href=http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#function>Function</a>? <a href=#dom-domtransaction-executeautomatic>executeAutomatic</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   630
    attribute <a href=http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#function>Function</a>? <a href=#dom-domtransaction-execute>execute</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   631
    attribute <a href=http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#function>Function</a>? <a href=#dom-domtransaction-undo>undo</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   632
    attribute <a href=http://www.whatwg.org/specs/web-apps/current-work/complete/webappapis.html#function>Function</a>? <a href=#dom-domtransaction-redo>redo</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   633
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   634
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   635
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   636
        <p>The <code><a href=#dom-domtransaction>DOMTransaction</a></code> interface is to be implemented by content scripts that implement a <a href=#dom-transaction>DOM transaction</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   637
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   638
        <p><dfn id=dom-domtransaction-label><code>label</code></dfn> attribute must return <code>null</code> or a string that
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   639
        describes the semantics of the transaction such as "Inserting text" or "Deleting selection".
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   640
        The user agent may expose this string or a part of this string through its native UI such as menu bar or context menu.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   641
        When there are multiple <a href=#dom-transaction>transactions</a> in a single entry of
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   642
        the <a href=#undo-transaction-history>undo transaction history</a>, the user agent that doesn't support displaying
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   643
        multiple labels for each entry must use the label of the first transaction in the sequence of the entry.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   644
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   645
        <p><dfn id=dom-domtransaction-executeautomatic><code>executeAutomatic()</code></dfn>, <dfn id=dom-domtransaction-execute><code>execute()</code></dfn>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   646
        <dfn id=dom-domtransaction-undo><code>undo()</code></dfn>, and <dfn id=dom-domtransaction-redo><code>redo()</code></dfn> are attributes that must be supported,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   647
        as IDL attributes, by objects implementing the <code><a href=#dom-domtransaction>DOMTransaction</a></code> interface.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   648
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   649
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   650
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   651
        <p>Any changes made to the value of <code><a href=#dom-domtransaction-executeautomatic>executeAutomatic</a></code>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   652
        <code><a href=#dom-domtransaction-execute>execute</a></code>, <code><a href=#dom-domtransaction-undo>undo</a></code>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   653
        or <code><a href=#dom-domtransaction-redo>redo</a></code> attributes will take effect immediately. In the following example,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   654
        <code><a href=#dom-domtransaction-execute>execute</a></code> and <code><a href=#dom-domtransaction-undo>undo</a></code> attributes are modified:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   655
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   656
        <pre>document.undoManager.transact({ executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   657
    this.executeAutomatic = function () { alert('foo'); }
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   658
    alert('bar');
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   659
}, undo: function () { alert('baz'); } }); // alerts 'bar'
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   660
document.undoManager.item(0)[0].undo = function() { alert('foobar'); }
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   661
docuemnt.undoManager.undo(); // alerts 'foobar'
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   662
</pre></div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   663
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   664
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   665
        <p><dfn id=dom-domtransaction-executeautomatic><code>executeAutomatic</code></dfn> attribute must return a valid function if the transaction is a <a href=#automatic-dom-transaction>automatic DOM transaction</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   666
        and <code>undefined</code> if it is a <a href=#manual-dom-transaction>manual DOM transaction</a> immediately before the transaction is <a href=#dom-transaction-apply>applied</a>.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   667
        Any changes made to the value of the <code><a href=#dom-domtransaction-executeautomatic>executeAutomatic</a></code> attribute while the transaction is being <a href=#dom-transaction-apply>applied</a> or after the transaction had been <a href=#dom-transaction-apply>applied</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   668
        should not change the type of the <a href=#dom-transaction>DOM transaction</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   669
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   670
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   671
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   672
        <p>All <a href=#dom-changes>DOM changes</a> made in <code><a href=#dom-domtransaction-execute>execute</a></code> or
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   673
        <code><a id=dom-domtransaction-executeautomatic>executeAutomatic</a></code> take effect immediately.
7
44f10659a665 Introduce the concept to disconnect an undo manager to replace the concept of destroying an undo manager per Olli's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 6
diff changeset
   674
        Sometimes, this <a href=#disconnect-undomanager>disconnects</a> the undoManager to which it belongs.</p>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   675
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   676
        <pre>var scope = document.createElement('div');
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   677
scope.undoScope = true;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   678
document.body.appendChild(scope);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   679
scope.undoManager.transact({execute: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   680
    scope.appendChild("foo");
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   681
    alert(scope.textContent); // "foo"
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   682
    scope.undoScope = false;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   683
}});
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   684
scope.undoManager.undo(); // Throws an error because undoManager returns null.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   685
</pre></div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   686
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   687
<h3 id=automatic-dom-transactions><span class=secno>3.3 </span>Automatic DOM transactions</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   688
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   689
    <p>An <dfn id=automatic-dom-transaction>automatic DOM transaction</dfn> is a <a href=#dom-transaction>DOM transaction</a> where <a href=#dom-changes>DOM changes</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   690
    are tracked by the user agent and the logic to <a href=#dom-transaction-unapply>unapply</a> or <a href=#dom-transaction-reapply>reapply</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   691
    the transaction is implicitly created by the user agent. </p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   692
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   693
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   694
        <p>When an <a href=#automatic-dom-transaction>automatic DOM transaction</a> is <a href=#dom-transaction-apply>applied</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   695
        the user agent must call the function returned by the <code><a id=dom-domtransaction-executeautomatic>executeAutomatic</a></code> attribute if the attribute returns a valid function object.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   696
        All <a href=#dom-changes>DOM changes</a> made by the method in the corresponding <a href=#undo-scope>undo scope</a> of the <code><a href=#undomanager>UndoManager</a><a></a></code><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   697
        must be tracked by the user agent.</a></p><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   698
    </a></div><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   699
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   700
    </a><div class=example><a>
6
ac6ab5cf2890 Add the forgotten undomanager.html change
Ryosuke Niwa <rniwa@webkit.org>
parents: 4
diff changeset
   701
        </a><p><a>All </a><a href=#dom-changes>DOM changes</a> made outside of the <a href=#undo-scope>undo scope</a> take effect immediately
ac6ab5cf2890 Add the forgotten undomanager.html change
Ryosuke Niwa <rniwa@webkit.org>
parents: 4
diff changeset
   702
        but are ignored for the purpose of undo and redo.
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   703
        In the following example, <code><a href=#dom-undomanager-undo>undo</a>()</code> will only remove "bar" and "foo"
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   704
        remains in the body.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   705
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   706
        <pre>var scope = document.createElement('div');
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   707
scope.undoScope = true;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   708
document.body.appendChild(scope);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   709
scope.undoManager.transact({executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   710
    document.body.appendChild("foo");
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   711
    scope.appendChild("bar");
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   712
}});
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   713
scope.undoManager.undo();
6
ac6ab5cf2890 Add the forgotten undomanager.html change
Ryosuke Niwa <rniwa@webkit.org>
parents: 4
diff changeset
   714
alert(document.body.textContent); // Alerts "foo".
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   715
</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   716
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   717
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   718
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   719
        <p>When an <a href=#automatic-dom-transaction>automatic DOM transaction</a> is <a href=#dom-transaction-unapply>unapplied</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   720
        the user agent must <a href=#revert-dom-changes>revert DOM changes</a> made inside the <a href=#undo-scope>undo scope</a> of the the <code><a href=#undomanager>UndoManager</a><a></a></code><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   721
        while </a><a href=#dom-transaction-apply>applying</a> the transaction, and call the function returned by the <code><a id=dom-domtransaction-undo>undo</a></code> attribute if the attribute returns a valid function object.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   722
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   723
        <p>When an <a href=#automatic-dom-transaction>automatic DOM transaction</a> is <a href=#dom-transaction-reapply>reapplied</a>,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   724
        the user agent must <a href=#unrevert-dom-changes>reapply DOM changes</a> made inside the <a href=#undo-scope>undo scope</a> of the the <code><a href=#undomanager>UndoManager</a><a></a></code><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   725
        while </a><a href=#dom-transaction-apply>applying</a> the transaction.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   726
        The user agent must then call the function returned by the <code><a id=dom-domtransaction-redo>redo</a></code> attribute if the attribute returns a valid function object.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   727
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   728
        <p>The user agent must also restore <a href=https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#concept-selection>selection</a> after
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   729
        <a href=#dom-transaction-unapply>unapplying</a> or <a href=#dom-transaction-reapply>reapplying</a> an <a href=#automatic-dom-transaction>automatic DOM transaction</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   730
        in accordance to user agent's platform convention.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   731
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   732
        <p>The user agent must implement <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#user-editing-actions>user editing actions</a> and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   733
        <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dnd>drag and drop</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   734
        as <a href=#automatic-dom-transaction>automatic DOM transactions</a>, and any application defined <a href=#automatic-dom-transactions>automatic DOM transactions</a> must be compatible with
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   735
        <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#user-editing-actions>user editing actions</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   736
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   737
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   738
    <p>In an <a href=#automatic-dom-transaction>automatic DOM transaction</a>, <code><a id=dom-domtransaction-execute>execute</a></code> attribute is ignored.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   739
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   740
<h4 id=automatic-transactions-and-manual-dom-changes><span class=secno>3.3.1 </span>Automatic transactions and manual DOM changes</h4>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   741
    <p>Authors should not modify nodes that are used by <a href=#automatic-dom-transaction>automatic DOM transactions</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   742
    in <a href=#revert-dom-changes>reverting</a> or <a href=#unrevert-dom-changes>reapplying</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   743
    <a href=#dom-changes>DOM changes</a> as it will interfere with the user agent's attempt to <a href=#transaction-unapply>unapply</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   744
    or <a href=#transaction-reapply>reapply</a> automatic DOM transactions.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   745
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   746
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   747
        <p>In the following example, the user agent terminates steps early while reverting
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   748
        the <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-node-insert>insertion</a> of
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   749
        the text node <code>" world"</code> in the first call to <code><a href=#dom-undomanager-undo>undo</a>()</code>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   750
        and doesn't make any <a href=#dom-changes>DOM changes</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   751
        <pre>var b = document.createTextNode("b");
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   752
b.appendChild(document.createTextNode("hello"));
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   753
document.body.appendChild(b);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   754
document.undoManager.transact({ executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   755
    document.body.appendChild(document.createTextNode(" world")); }});
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   756
b.appendChild(document.body.lastChild);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   757
document.undoManager.undo(); // No-op.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   758
</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   759
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   760
        <p>On the other hand, if we store the <a href=#dom-state>DOM state</a> as done below, then the call to
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   761
        <code><a href=#dom-undomanager-undo>undo</a>()</code> will successfully remove the the text node from the body.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   762
<pre>document.undoManager.redo(); // No-op.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   763
document.body.appendChild(b.lastChild);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   764
document.undoManager.undo(); // " world" is removed from document.body
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   765
</pre></div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   766
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   767
<h3 id=manual-dom-transactions><span class=secno>3.4 </span>Manual DOM transactions</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   768
    <p>A <dfn id=manual-dom-transaction>manual DOM transaction</dfn> is a <a href=#dom-transaction>DOM transaction</a> where the logic to
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   769
    <a href=#dom-transaction-unapply>apply</a>, <a href=#dom-transaction-unapply>unapply</a>, or <a href=#dom-transaction-reapply>reapply</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   770
    the transaction is explicitly defined by an application.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   771
    It provides a way to communicate with user agent's <a href=#undo-transaction-history>undo transaction history</a>, e.g. to populate user agent's undo menu.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   772
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   773
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   774
        <p>When a <a href=#manual-dom-transaction>manual DOM transaction</a> is <a href=#dom-transaction-apply>applied</a>, the user agnet must call
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   775
        the function returned by the <code><a id=dom-domtransaction-execute>execute</a></code> if the attribute returns a valid function object.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   776
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   777
        <p>When a <a href=#manual-dom-transaction>manual DOM transaction</a> is <a href=#dom-transaction-unapply>unapplied</a>, the user agnet must call
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   778
        the function returned by the <code><a id=dom-domtransaction-undo>undo</a></code> attribute if the attribute returns a valid function object.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   779
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   780
        <p>When a <a href=#manual-dom-transaction>manual DOM transaction</a> is <a href=#dom-transaction-reapply>reapplied</a>, the user agnet must call
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   781
        the function returned by the <code><a id=dom-domtransaction-redo>redo</a></code> attribute if the attribute returns a valid function object.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   782
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   783
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   784
    <p>In a <a href=#manual-dom-transaction>manual DOM transaction</a>, <code><a id=dom-domtransaction-executeautomatic>executeAutomatic</a></code> attribute is ignored.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   785
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   786
    <p class=note>Manual DOM transactions may be incompatible with automatic DOM transactions, in particular,
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   787
    with <a href=http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#user-editing-actions>user editing actions</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   788
    if manual DOM transaction mutates nodes that are dependent on by <a href=#automatic-dom-transaction>automatic DOM transactions</a>.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   789
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   790
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   791
        <p><a href=#manual-dom-transaction>Manual DOM transactions</a> will let authors populate items
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   792
        in the <a href=#undo-transaction-history>undo transaction history</a>. In particular, this will let
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   793
        the user agent to fill native UIs such as menu bars to display undoable actions.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   794
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   795
        <pre>function drawLine(start, end, style) {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   796
    document.undoManager.transact({ execute: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   797
            // Draw a line on canvas
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   798
        }, undo: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   799
            // Undraw a line
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   800
        }, redo: function () { this.execute(); },
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   801
        'Draw a line'
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   802
    });
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   803
}
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   804
</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   805
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   806
        <p>In this example, <var>drawLine()</var> will add a new entry to the document's
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   807
        <a href=#undo-transaction-history>undo transaction history</a> and the user agent can communicate the existence
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   808
        of this undoable action via UIs such as context menu and menubars.</div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   809
    
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   810
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   811
<h2 id=transaction,-undo,-and-redo-events><span class=secno>4 </span>Transaction, Undo, and Redo Events</h2>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   812
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   813
    <p>When a new <a href=#dom-transaction>DOM transaction</a> is <a href=#dom-transaction-apply>applied</a> by <code><a href=#dom-undomanager-transact>transact</a>()</code> method to an <a href=#undo-transaction-history>undo transaction history</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   814
    of a <code><a href=#undomanager>UndoManager</a></code>, the user agent must fire a <dfn id=dom-transaction-event>DOM transaction event</dfn> using
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   815
    the <code><dfn id=dom-transactionevent title=dom-transactionEvent>TransactionEvent</dfn></code> interface.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   816
    When a <a href=#dom-transaction>DOM transaction</a> is <a href=#dom-transaction-unapply>unapplied</a> or <a href=#dom-transaction-reapply>reapplied</a> though <code><a href=#dom-undomanager-undo>undo</a>()</code> method or
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   817
    <code><a href=#dom-undomanager-redo>redo</a>()</code> method, of a <code><a href=#undomanager>UndoManager</a></code>, the user agent must fire
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   818
    an <dfn id=undo-event>undo event</dfn> and a <dfn id=redo-event>redo event</dfn> respectively.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   819
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   820
<h3 id=the-domtransactionevent-interface><span class=secno>4.1 </span>The <code><a href=#domtransactionevent>DOMTransactionEvent</a></code> interface</h3>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   821
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   822
    <pre class=idl>[Constructor(DOMString type, optional EventInit eventInitDict)]
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   823
interface <dfn id=domtransactionevent>DOMTransactionEvent</dfn> : <a href=http://www.whatwg.org/specs/web-apps/current-work/#event>Event</a> {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   824
    readonly attribute Object <a href=#dom-domtransactionevent-transaction>transaction</a>;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   825
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   826
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   827
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   828
        <dt><var title="">DOMTransactionEvent</var> . <code title=dom-domtransactionevent-transaction><a href=#dom-domtransactionevent-transaction>transaction</a></code></dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   829
        <dd><p>Returns the transaction object that triggered this event.</dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   830
    </dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   831
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   832
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   833
        <p>The <dfn id=dom-domtransactionevent-transaction title=dom-DOMTransactionEvent-transaction><code>transaction</code></dfn> attribute of
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   834
        the <code><a href=#dom-domtransactionevent>DOMTransactionEvent</a></code> interface must return the object that implements
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   835
        the <code><a href=#dom-domtransaction>DOMTransactionEvent</a></code> interface that triggered the event.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   836
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   837
        <p>When the user agent is required to <dfn id=fire-a-dom-transaction-event>fire a DOM transaction event</dfn> for a <a href=#dom-transaction>DOM transaction</a> <var>t</var> at
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   838
        an <a href=#undo-scope-host>undo scope host</a> <var>h</var>, the user agent must run the following steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   839
        <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   840
            <li>Create a <code><a href=#dom-domtransactionevent>DOMTransactionEvent</a></code> object and initialize it to have the name "<code><a href=#dom-domtransaction>DOMTransaction</a></code>",
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   841
            to bubble, to not cancelable, and to have the <code>transaction</code> attribute initialized to <var>t</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   842
            <li>Dispatch the newly created <code><a href=#dom-domtransactionevent>DOMTransactionEvent</a></code> object at the node <var>h</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   843
        </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   844
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   845
        <p>When the user agent is required to <dfn id=fire-an-undo-event>fire an undo event</dfn> and <dfn id=fire-a-redo-event>fire a redo event</dfn> for a <a href=#dom-transaction>DOM transaction</a> <var>t</var> at
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   846
        an <a href=#undo-scope-host>undo scope host</a> <var>h</var>, the user agent must run the following steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   847
        <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   848
            <li>Create a <code><a href=#dom-domtransactionevent>DOMTransactionEvent</a></code> object and initialize it to have the name "<code><a href=#undo>undo</a></code>" and
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   849
            "<code><a href=#redo>redo</a></code>" respectively, to bubble, to not cancelable, and to have the <code>transaction</code> attribute initialized to <var>t</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   850
            <li>Dispatch the newly created <code><a href=#dom-domtransactionevent>TransactionEvent</a></code> object at the node <var>h</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   851
        </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   852
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   853
        <p class=note>The target node is always set to a <a href=#undo-scope-host>undo scope host</a> or a node that was a <a href=#undo-scope-host>undo scope host</a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   854
        immediately before <var>t</var> was applied, unapplied, or reapplied.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   855
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   856
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   857
<script src=http://www.whatwg.org/specs/web-apps/current-work/dfn.js></script>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   858
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   859