[デフォルト] DeleteLeft, Delete
-
// 動かない
document.selection.DeleteLeft();
document.selection.Delete(); Alert("どう?");
// 動く
document.selection.DeleteLeft(1);
document.selection.Delete(1); Alert("どう?");マニュアルには、引数が省略可能と書いてありますが、実際は省略できません。
こちらのメソッド再定義で、デフォルト引数を設定してしまっている場合は、
この不具合は、発覚しません。
私が、デフォルト引数を設定するのが面倒で、空のままメソッドを呼び出すと、
kuro さんの面倒くさがっている部分が浮き上がってくるような感じです。シンクロwこれもあやしい。
document.selection.LineUp(bExtend, c); document.selection.LineDown(bExtend, c);
document.selection.CharLeft(bExtend, c); document.selection.CharRight(bExtend, c);
document.selection.PageDown(bExtend, c); document.selection.PageUp(bExtend, c);
document.selection.WordLeft(c); document.selection.WordRight(c);
document.selection.Indent(c); document.selection.Unindent(c);| kinzoku | 返信 -
あれ?
>document.selection.LineUp(bExtend, c); document.selection.LineDown(bExtend, c);
マニュアルには、bExtend の記述がない。
CharRight, CharLeft のラッパーを先に書いたから、
LineUp, LineDown も同類として、bExtend を入れていたんだ・・・・
でも、これ動くぞ。 bExtend は必要だから、いいけど。もしかして、マニュアルに記載されていない、WordLeft, WordRight にも、
bExtend があったりして。
document.selection.WordLeft(true, 3);
おお、選択範囲が広がった。ワロタ。wdocument.selection.WordLeft();
一応、引数無しは動きます。| kinzoku | 返信 -
こんばんは。ご報告ありがとうございます!
まず、
document.selection.DeleteLeft();
document.selection.Delete();ですが、引数省略時は「0」を指定したときの動作になります。
つまり、選択範囲がないと何も削除されません。
(引数省略時は1を指定した動作にしたほうがいいかもしれませんね。。。)> document.selection.LineUp(bExtend, c); document.selection.LineDown(bExtend, c);
> document.selection.CharLeft(bExtend, c); document.selection.CharRight(bExtend, c);
> document.selection.PageDown(bExtend, c); document.selection.PageUp(bExtend, c);
> document.selection.WordLeft(c); document.selection.WordRight(c);
> document.selection.Indent(c); document.selection.Unindent(c);ここら辺はマニュアルの記載漏れですね、すみませんでした。
| Kuro | 返信