undomanager.html
author Ryosuke Niwa <rniwa@webkit.org>
Wed, 04 Jul 2012 14:50:23 -0700
changeset 12 46189be9cb28
parent 11 3fbf142909a7
child 14 9cae0e0c55cb
permissions -rwxr-xr-x
Fix typos per Caio Marcelo de Oliveira Filho's comment.
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
11
3fbf142909a7 Update the date.
Ryosuke Niwa <rniwa@webkit.org>
parents: 10
diff changeset
    11
<h2 class="no-num no-toc" id="editor's-draft-&mdash;-8-june-2012">Editor's draft &mdash; 8 June 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>
11
3fbf142909a7 Update the date.
Ryosuke Niwa <rniwa@webkit.org>
parents: 10
diff changeset
    27
<dd><a href=http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html>
3fbf142909a7 Update the date.
Ryosuke Niwa <rniwa@webkit.org>
parents: 10
diff changeset
    28
http://dvcs.w3.org/hg/undomanager/raw-file/17a725399127/undomanager.html</a> (29 May 2012)</dd>
2
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
    29
<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
    30
http://rniwa.com/editing/undomanager-2011-03-27.html</a></dd>
8
17a725399127 Add the missing link to http://rniwa.com/editing/undomanager-2011-12-05.html
Ryosuke Niwa <rniwa@webkit.org>
parents: 7
diff changeset
    31
<dd><a href=http://rniwa.com/editing/undomanager-2011-12-05.html>
17a725399127 Add the missing link to http://rniwa.com/editing/undomanager-2011-12-05.html
Ryosuke Niwa <rniwa@webkit.org>
parents: 7
diff changeset
    32
http://rniwa.com/editing/undomanager-2011-12-05.html</a></dd>
0
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-12-01.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-12-01.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-11-29.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-11-29.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-27.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-27.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-10-20.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-10-20.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-10-09.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-10-09.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-09-11.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-09-11.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-30.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-30.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-08-09.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-08-09.html</a></dd>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    49
<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
    50
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
    51
<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
    52
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
    53
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    54
<dt>Use cases:</dt>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    55
<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
    56
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
    57
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    58
</dl>
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
</div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    61
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    62
<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
    63
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    64
<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
    65
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
    66
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
    67
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    68
<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
    69
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    70
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    71
<!--begin-toc-->
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    72
<ol class=toc>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    73
 <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
    74
 <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
    75
  <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    76
   <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
    77
   <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
    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=#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
    80
     <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
    81
   <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
    82
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    83
     <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
    84
   <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
    85
   <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
    86
 <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
    87
  <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    88
   <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
    89
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    90
     <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
    91
     <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
    92
   <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
    93
   <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
    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=#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
    96
   <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
    97
 <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
    98
  <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
    99
   <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
   100
<!--end-toc-->
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   101
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   102
<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
   103
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   104
    <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
   105
    (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
   106
    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
   107
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   108
    <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
   109
    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
   110
    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
   111
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   112
    <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
   113
    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
   114
    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
   115
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   116
    <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
   117
    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
   118
    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
   119
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   120
    <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
   121
    <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
   122
    by user agents.</p>
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
<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
   125
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   126
<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
   127
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   128
    <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
   129
    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
   130
    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
   131
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   132
    <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
   133
    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
   134
    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
   135
    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
   136
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   137
    <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
   138
    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
   139
    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
   140
    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
   141
    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
   142
    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
   143
    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
   144
    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
   145
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   146
<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
   147
    <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
   148
    <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
   149
    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
   150
    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
   151
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   152
    <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
   153
    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
   154
    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
   155
    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
   156
    
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   157
    <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
   158
    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
   159
    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
   160
    <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
   161
    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
   162
    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
   163
    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
   164
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   165
<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
   166
    <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
   167
    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
   168
    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
   169
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   170
    <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
   171
    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
   172
    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
   173
    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
   174
    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
   175
    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
   176
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   177
    <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
   178
    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
   179
    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
   180
    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
   181
    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
   182
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   183
<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
   184
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   185
    <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
   186
    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
   187
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   188
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   189
        <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
   190
        <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
   191
    </dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   192
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   193
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   194
        <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
   195
        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
   196
    </div>
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
<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
   199
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   200
    <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
   201
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   202
    <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
   203
    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
   204
    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
   205
    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
   206
    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
   207
    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
   208
    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
   209
    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
   210
    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
   211
};</pre>
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
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   214
        <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
   215
        <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
   216
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   217
        <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
   218
        <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
   219
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   220
        <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
   221
            <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
   222
        <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
   223
            and adds it to the beginning of the first entry in <a href=#undo-transaction-history>undo transaction history</a><a>,
10
53943e40f7a0 Fix another typo. undoManager.item() should return the entry when 0 <= n < length, not when n is length.
Ryosuke Niwa <rniwa@webkit.org>
parents: 8
diff changeset
   224
            or of a new </a><a href=#undo-transaction-history>undo transaction history</a><a> if <var title="">merge</var> is set to false.</a></dd><a>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   225
2
2b10939e6831 Remove references to transaction groups per Alex & Olli's comments.
Ryosuke Niwa <rniwa@webkit.org>
parents: 1
diff changeset
   226
        </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
   227
        <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
   228
            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
   229
            <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
   230
            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
   231
            <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
   232
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   233
        <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
   234
        <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
   235
            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
   236
            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
   237
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   238
        <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
   239
        <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
   240
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   241
        </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
   242
        <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
   243
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   244
        </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
   245
        <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
   246
        <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
   247
            <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
   248
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   249
        </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
   250
        <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
   251
            <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
   252
            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
   253
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   254
        <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
   255
        <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
   256
            <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
   257
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   258
    </dl>
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
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   261
        <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
   262
        <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
   263
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   264
        <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
   265
        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
   266
        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
   267
        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
   268
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   269
        <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
   270
        <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
   271
            <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
   272
                <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
   273
                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
   274
                <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
   275
            <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
   276
            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
   277
            <li><a href=#dom-transaction-apply>Apply</a> the <var title="">transaction</var>.</li>
10
53943e40f7a0 Fix another typo. undoManager.item() should return the entry when 0 <= n < length, not when n is length.
Ryosuke Niwa <rniwa@webkit.org>
parents: 8
diff changeset
   278
            <li>If <var title="">merge</var> is set to false, add an empty entry to the beginning of the <a href=#undo-transaction-history>undo transaction history</a>.</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
   279
            <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
   280
            <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
   281
            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
   282
        </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   283
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   284
        <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
   285
        <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
   286
            <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
   287
                <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
   288
                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
   289
                <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
   290
            <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
   291
            <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
   292
            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
   293
            <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
   294
            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
   295
        </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   296
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   297
        <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
   298
        <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
   299
            <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
   300
                <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
   301
                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
   302
                <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
   303
            <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
   304
            <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
   305
            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
   306
            <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
   307
            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
   308
        </ol>
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>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
   311
        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
10
53943e40f7a0 Fix another typo. undoManager.item() should return the entry when 0 <= n < length, not when n is length.
Ryosuke Niwa <rniwa@webkit.org>
parents: 8
diff changeset
   312
        0 &le; <var>n</var> &lt; <code title=dom-UndoManager-length><a href=#dom-undomanager-length>length</a></code>, or null otherwise.</p>
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   313
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   314
        <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
   315
        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
   316
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   317
        <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
   318
        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
   319
        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
   320
        <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
   321
        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
   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-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
   324
        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
   325
        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
   326
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   327
        <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
   328
        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
   329
        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
   330
        <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
   331
        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
   332
        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
   333
        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
   334
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   335
        <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
   336
        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
   337
        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
   338
        <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
   339
        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
   340
        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
   341
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   342
        <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
   343
        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
   344
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
        <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
   346
        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
   347
        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
   348
        <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
   349
        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
   350
        <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
   351
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   352
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   353
    <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
   354
    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
   355
    <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
   356
    </p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   357
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   358
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   359
        <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
   360
        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
   361
        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
   362
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   363
        <pre>document.undoManager.transact(...);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   364
document.undoManager.transact(..., true);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   365
document.undoManager.transact(..., true);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   366
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
   367
document.undoManager.item(0).pop();
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   368
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
   369
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
   370
</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   371
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   372
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   373
    <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
   374
    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
   375
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   376
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   377
        <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
   378
        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
   379
        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
   380
        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
   381
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   382
        <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
   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.createTextNode('o')); }, 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('k')); }, label: 'Typing'}, true);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   387
myEditor.undoManager.transact({executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   388
    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
   389
myEditor.undoManager.transact({executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   390
    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
   391
</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   392
        <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
   393
        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
   394
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   395
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   396
    <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
   397
    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
   398
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   399
<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
   400
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   401
    <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
   402
    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
   403
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   404
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   405
        <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
   406
        <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
   407
        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
   408
    </dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   409
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   410
    <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
   411
    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
   412
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   413
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   414
        <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
   415
        <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
   416
    </dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   417
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   418
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   419
        <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
   420
        <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
   421
        <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
   422
        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
   423
        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
   424
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   425
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   426
<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
   427
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   428
    <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
   429
    <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
   430
    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
   431
    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
   432
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   433
<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
   434
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   435
    <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
   436
    <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
   437
    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
   438
    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
   439
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   440
<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
   441
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   442
    <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
   443
    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
   444
    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
   445
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   446
    <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
   447
    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
   448
    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
   449
    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
   450
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   451
    <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
   452
    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
   453
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   454
<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
   455
    <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
   456
    <ul>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   457
        <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
   458
        <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
   459
        <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
   460
        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
   461
        <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
   462
        <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
   463
        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
   464
        <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
   465
    </ul>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   466
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   467
    <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
   468
    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
   469
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   470
<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
   471
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   472
    <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
   473
    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
   474
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   475
    <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
   476
    run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   477
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   478
        <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
   479
        <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
   480
        <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
   481
        <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
   482
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   483
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   484
    <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
   485
    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
   486
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   487
        <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
   488
        <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
   489
        <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
   490
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   491
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   492
    <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
   493
    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
   494
    and run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   495
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   496
        <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
   497
        <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
   498
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   499
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   500
    <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
   501
    <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
   502
    <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
   503
    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
   504
    <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
   505
    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
   506
    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
   507
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   508
    <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
   509
    <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
   510
    <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
   511
    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
   512
    run these steps.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   513
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   514
        <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
   515
        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
   516
        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
   517
        <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
   518
        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
   519
        <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
   520
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   521
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   522
    <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
   523
    <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
   524
    <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
   525
    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
   526
    <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
   527
    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
   528
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   529
        <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
   530
        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
   531
        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
   532
        <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
   533
        <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
   534
        <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
   535
        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
   536
        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
   537
        to <var>oldPrefix</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   538
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   539
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   540
    <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
   541
    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
   542
    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
   543
    <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
   544
    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
   545
    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
   546
    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
   547
    before the setting respectively.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   548
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   549
<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
   550
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   551
    <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
   552
    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
   553
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   554
    <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
   555
    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
   556
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   557
        <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
   558
        <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
   559
        <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
   560
        <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
   561
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   562
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   563
    <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
   564
    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
   565
    and run these steps:</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   566
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   567
        <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
   568
        <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
   569
        <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
   570
        <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
   571
        <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
   572
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   573
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   574
    <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
   575
    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
   576
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   577
        <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
   578
        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
   579
        <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
   580
        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
   581
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   582
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   583
    <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
   584
    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
   585
    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
   586
    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
   587
    <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
   588
    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
   589
    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
   590
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   591
    <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
   592
    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
   593
    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
   594
    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
   595
    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
   596
    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
   597
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   598
        <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
   599
        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
   600
        <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
   601
        <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
   602
        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
   603
        <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
   604
        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
   605
        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
   606
        to <var>prefix</var>.</li>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   607
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   608
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   609
    <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
   610
    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
   611
    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
   612
    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
   613
    <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   614
        <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
   615
        <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
   616
        <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
   617
        <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
   618
        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
   619
        <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
   620
    </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   621
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   622
    <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
   623
    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
   624
    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
   625
    <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
   626
    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
   627
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   628
<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
   629
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   630
    <pre class=idl>[NoInterfaceObject]
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   631
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
   632
    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
   633
    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
   634
    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
   635
    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
   636
    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
   637
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   638
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   639
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   640
        <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
   641
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   642
        <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
   643
        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
   644
        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
   645
        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
   646
        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
   647
        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
   648
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   649
        <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
   650
        <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
   651
        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
   652
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   653
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   654
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   655
        <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
   656
        <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
   657
        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
   658
        <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
   659
12
46189be9cb28 Fix typos per Caio Marcelo de Oliveira Filho's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 11
diff changeset
   660
        <pre>document.undoManager.transact({ execute: function () {
46189be9cb28 Fix typos per Caio Marcelo de Oliveira Filho's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 11
diff changeset
   661
    this.execute = function () { alert('foo'); }
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   662
    alert('bar');
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   663
}, 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
   664
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
   665
docuemnt.undoManager.undo(); // alerts 'foobar'
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   666
</pre></div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   667
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   668
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   669
        <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
   670
        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
   671
        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
   672
        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
   673
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   674
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   675
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   676
        <p>All <a href=#dom-changes>DOM changes</a> made in <code><a href=#dom-domtransaction-execute>execute</a></code> or
12
46189be9cb28 Fix typos per Caio Marcelo de Oliveira Filho's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 11
diff changeset
   677
        <code><a href=#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
   678
        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
   679
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   680
        <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
   681
scope.undoScope = true;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   682
document.body.appendChild(scope);
12
46189be9cb28 Fix typos per Caio Marcelo de Oliveira Filho's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 11
diff changeset
   683
scope.undoManager.transact({executeAutomatic: function () {
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   684
    scope.appendChild("foo");
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   685
    alert(scope.textContent); // "foo"
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   686
    scope.undoScope = false;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   687
}});
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   688
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
   689
</pre></div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   690
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   691
<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
   692
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   693
    <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
   694
    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
   695
    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
   696
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   697
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   698
        <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
   699
        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
   700
        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
   701
        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
   702
    </a></div><a>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   703
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   704
    </a><div class=example><a>
6
ac6ab5cf2890 Add the forgotten undomanager.html change
Ryosuke Niwa <rniwa@webkit.org>
parents: 4
diff changeset
   705
        </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
   706
        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
   707
        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
   708
        remains in the body.</p>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   709
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   710
        <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
   711
scope.undoScope = true;
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   712
document.body.appendChild(scope);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   713
scope.undoManager.transact({executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   714
    document.body.appendChild("foo");
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   715
    scope.appendChild("bar");
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   716
}});
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   717
scope.undoManager.undo();
6
ac6ab5cf2890 Add the forgotten undomanager.html change
Ryosuke Niwa <rniwa@webkit.org>
parents: 4
diff changeset
   718
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
   719
</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   720
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   721
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   722
    <div class=impl>
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-unapply>unapplied</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=#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
   725
        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
   726
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   727
        <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
   728
        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
   729
        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
   730
        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
   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 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
   733
        <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
   734
        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
   735
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   736
        <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
   737
        <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
   738
        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
   739
        <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
   740
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   741
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   742
    <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
   743
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   744
<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
   745
    <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
   746
    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
   747
    <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
   748
    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
   749
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   750
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   751
        <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
   752
        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
   753
        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
   754
        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
   755
        <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
   756
b.appendChild(document.createTextNode("hello"));
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   757
document.body.appendChild(b);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   758
document.undoManager.transact({ executeAutomatic: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   759
    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
   760
b.appendChild(document.body.lastChild);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   761
document.undoManager.undo(); // No-op.
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   762
</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   763
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   764
        <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
   765
        <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
   766
<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
   767
document.body.appendChild(b.lastChild);
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   768
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
   769
</pre></div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   770
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   771
<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
   772
    <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
   773
    <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
   774
    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
   775
    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
   776
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   777
    <div class=impl>
12
46189be9cb28 Fix typos per Caio Marcelo de Oliveira Filho's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 11
diff changeset
   778
        <p>When a <a href=#manual-dom-transaction>manual DOM transaction</a> is <a href=#dom-transaction-apply>applied</a>, the user agent must call
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   779
        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
   780
12
46189be9cb28 Fix typos per Caio Marcelo de Oliveira Filho's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 11
diff changeset
   781
        <p>When a <a href=#manual-dom-transaction>manual DOM transaction</a> is <a href=#dom-transaction-unapply>unapplied</a>, the user agent must call
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   782
        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
   783
12
46189be9cb28 Fix typos per Caio Marcelo de Oliveira Filho's comment.
Ryosuke Niwa <rniwa@webkit.org>
parents: 11
diff changeset
   784
        <p>When a <a href=#manual-dom-transaction>manual DOM transaction</a> is <a href=#dom-transaction-reapply>reapplied</a>, the user agent must call
0
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   785
        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
   786
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   787
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   788
    <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
   789
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   790
    <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
   791
    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
   792
    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
   793
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   794
    <div class=example>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   795
        <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
   796
        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
   797
        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
   798
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   799
        <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
   800
    document.undoManager.transact({ execute: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   801
            // Draw a line on canvas
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   802
        }, undo: function () {
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   803
            // Undraw a line
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   804
        }, redo: function () { this.execute(); },
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   805
        'Draw a line'
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   806
    });
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   807
}
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   808
</pre>
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
        <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
   811
        <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
   812
        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
   813
    
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   814
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   815
<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
   816
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   817
    <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
   818
    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
   819
    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
   820
    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
   821
    <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
   822
    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
   823
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   824
<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
   825
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   826
    <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
   827
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
   828
    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
   829
};</pre>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   830
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   831
    <dl class=domintro>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   832
        <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
   833
        <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
   834
    </dl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   835
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   836
    <div class=impl>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   837
        <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
   838
        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
   839
        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
   840
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   841
        <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
   842
        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
   843
        <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   844
            <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
   845
            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
   846
            <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
   847
        </ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   848
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   849
        <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
   850
        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
   851
        <ol>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   852
            <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
   853
            "<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
   854
            <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
   855
        </ol>
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
        <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
   858
        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
   859
    </div>
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   860
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   861
<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
   862
2f3551c872b8 Import files from https://github.com/rniwa/undomanager/commit/a2fb3b2096105bb0506f41edddde0e155a14ba4b
Ryosuke Niwa <rniwa@webkit.org>
parents:
diff changeset
   863