<!jaxb xmlanyelementT TI (any) >是什么意思

etElementByID getElementsByName getElementsByTagName都要什么意思啊_百度知道
etElementByID getElementsByName getElementsByTagName都要什么意思啊
在js中 它们都是什么意思啊 有什么区别啊
提问者采纳
B charset=gb2312&;body&gt.w3;&docname&quot,用getElementsByTagName(&quot.dtd" target="_blank">&title&gt,#docid2{&&.01 Transitional/&gt,用getElementsByTagName(&JavaScript&// id=&title&gt。&DTD HTML 4;div id=&quot.org/TR/xhtml1/DTD/xhtml1-&/&docnObj[1];script language=&quot.backgroundColor = &&lt,它们有自己的方便之处:&&head&gt.w3,复数ELEMENTS代表获得的不是一个元素;docname&quot.all[]也不是全无是处;div&head&bgcolor()&quot, getElementsByName().w3;&&;/body&&#47,但IE不支持getElementsByName();/&lt。比如有两个DIV!--function bgcolor(){var docnObj=EN&quot,但getElementsByName()和不符合标准的document://www,顾名思义;css&title&gt,访问某一特定元素尽量用标准的getElementById();html xmlns=&/div&quot:400docname&style type=&quot,所以就要避免使用getElementsByName();& content=&&}--&gt,可以用getElementsByTagName(&&gt://docid&/&&#47.w3; charset=gb2312&ById&lt.w3;)[0]访问第一个DIV、getElementsByTagName()这个呢就是通过TAGNAME(标签名称)来获得元素;)来获得这个元素:400script&gt,但NAME却可以重复;-/ id=&text/css&quot.org/TR/html4/loose?因为DOCUMENT中每一个元素的ID是唯一的;&gt.body&text/)[0]访问第一个DIV;&#47:#999,虽然现实中有重复);script&&#47.org/1999/xhtml" target="_blank">).w3,访问标签用标准的getElementByTagName();docid1&div&style&&div name=&docid2&background-color://www!--#docid1:#999;&#47,所以这个方法也是取得一个数组, and getElementsByTagName()访问DOCUMENT中的任一个标签;<a href=" type=&&lt
提问者评价
其他类似问题
为您推荐:
getelementsbytagname的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁XML中关于DTD的一个问题_百度知道
XML中关于DTD的一个问题
&lt, 简介5个有序的子元素的同时是否也表示这5 个子元素也构成了一个元素组呢, 作者!ELEMENT 计算机书籍 ((书名;;
在表示计算机书籍里 包括书名.我想问问大大们;,如果这样写&, 作者, 简介))&gt, 价格, 价格DTD中允许使用圆括号将多个子元素括起来形成元素组, 作者!ELEMENT 计算机书籍 (书名, 价格, 简介)&gt。书里举了例子
提问者采纳
ELEMENT a (#PCDATA)&gt,那么通常无需嵌套括号,不然就需要进行嵌套!ELEMENT c (c1|c2)*&gt实际上, Any。在W3C标准中;其中 元素内容可以是;等等如果一个元素的子元素都是有序的或者都是选择性的,与一个括号没有任何区别;&lt!ELEMENT e (e1;!ELEMENT o any&gt: E&lt, (e21|e22))&gt、注解(Notation),能定义的只有元素(Element);你那个书里这样连续两个括号是没有意义的,其他都需要在外面有一个括号;,如;&lt、属性(Attribute):&lt、实体(Entity)!ELEMENT 元素名 元素内容&gt, b2)&gt:&lt。其中定义一个元素的方式的语法是;,在DTD中的括号与普通运算中的括号作用没什么不同的地方;;。你那本书上说的元素组实际上并没有什么作用, 混合等这里除了Empty或Any外:&lt, 子元素!ELEMENT b (b1,如;
其他类似问题
为您推荐:
其他2条回答
作者&lt, 简介)&gt!ELEMENT 计算机书籍 (书名; 书名, 价格, 作者, 价格;
不是。其实DTD有点out了,功能不强,有自己独立的语法,数据类型单一……试试Schema吧
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁((i&9)?i: 0 +i) 是什么意思_百度知道
((i&9)?i: 0 +i) 是什么意思
innerHTML =}tmp += &month_container&var tmp = &script&&script lanuage=&option&&&#47;var H_select =&&;?i;程序中((i&&&);span id = &&#47;&+i) + &quot:&& i &option&&select&&JavaScript&quot?i;9);0&& + ((i&= 12.getElementbyId(&&#47; i++){
tmp += &&H_for (var i = 1;&#47;select&&9);span&month_container&quot&lt
[^&&)&&span class=&#92![^&zy&#92;
for (var i = 0;span&gt, & List?;&;
var postTag = &&;gim&;}程序中的var preTag = && i++)
if (List[i])
myReg = new RegExp(&;&zy&#92;& + postTag); i &)(;&)
NewTxt =&span class=&#92;
};&&$1&quot,
preTag + &quot.replace(myReg?;]*&& + List[i] + &&#47;(&quot.&
var preTag = &
var NewTxtfunction TextReplace(txt)
var myR&]*&gt
提问者采纳
if i&0&9 then
&quot,相当于这是if语句的简写
提问者评价
其他类似问题
为您推荐:
其他1条回答
换种写法你就能看得懂了;9){i+i.if(i&gt这是个三目运算符;}else{0+i
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁spacer.gif
_translationstatus.txt
logo_ckeditor.png
colordialog
placeholder.png
hiddenfield.gif
placeholder.png
iframedialog
anchor.gif
pagebreak.gif
pastefromword
placeholder
placeholder.gif
toolbar.css
showblocks
block_address.png
block_blockquote.png
block_div.png
block_h1.png
block_h2.png
block_h3.png
block_h4.png
block_h5.png
block_h6.png
block_p.png
block_pre.png
angel_smile.gif
angry_smile.gif
broken_heart.gif
confused_smile.gif
cry_smile.gif
devil_smile.gif
embaressed_smile.gif
envelope.gif
lightbulb.gif
omg_smile.gif
regular_smile.gif
sad_smile.gif
shades_smile.gif
teeth_smile.gif
thumbs_down.gif
thumbs_up.gif
tounge_smile.gif
whatchutalkingabout_smile.gif
wink_smile.gif
specialchar
tableresize
tabletools
template1.gif
template2.gif
template3.gif
hue_bg.png
hue_thumb.png
picker_mask.png
picker_thumb.png
uicolor.gif
ciframe.html
tmpFrameset.html
dialog_sides.gif
dialog_sides.png
dialog_sides_rtl.png
noimage.png
sprites.png
sprites_ie6.png
toolbar_start.gif
dialog.css
editor.css
icons_rtl.png
templates.css
office2003
dialog_sides.gif
dialog_sides.png
dialog_sides_rtl.png
noimage.png
sprites.png
sprites_ie6.png
dialog.css
editor.css
icons_rtl.png
templates.css
dialog_sides.gif
dialog_sides.png
dialog_sides_rtl.png
noimage.png
sprites.png
sprites_ie6.png
toolbar_start.gif
dialog.css
editor.css
icons_rtl.png
templates.css
application.xml
sample.html
api_dialog
index.html
output_for_flash.fla
output_for_flash.swf
output_xhtml.css
_posteddata.php.tpl
advanced.php
advanced.php.tpl
events.php
events.php.tpl
index.html
replace.php.tpl
replaceall.php
replaceall.php.tpl
standalone.php.tpl
api_dialog.html
autogrow.html
divreplace.html
enterkey.html
fullpage.html
index.html
jqueryadapter.html
output_for_flash.html
output_html.html
output_xhtml.html
placeholder.html
replacebyclass.html
replacebycode.html
sample.css
sample_posteddata.php
sample_posteddata.php.tpl
sharedspaces.html
skins.html
ui_color.html
ui_languages.html
htmlparser
_translationstatus.txt
logo_ckeditor.png
basicstyles
blockquote
colorbutton
colordialog
contextmenu
dialogadvtab
domiterator
editingblock
elementspath
fakeobjects
filebrowser
placeholder.png
floatpanel
hiddenfield.gif
horizontalrule
htmldataprocessor
htmlwriter
placeholder.png
iframedialog
keystrokes
anchor.gif
menubutton
pagebreak.gif
panelbutton
pastefromword
placeholder
placeholder.gif
removeformat
toolbar.css
showblocks
block_address.png
block_blockquote.png
block_div.png
block_h1.png
block_h2.png
block_h3.png
block_h4.png
block_h5.png
block_h6.png
block_p.png
block_pre.png
showborders
angel_smile.gif
angry_smile.gif
broken_heart.gif
confused_smile.gif
cry_smile.gif
devil_smile.gif
embaressed_smile.gif
envelope.gif
lightbulb.gif
omg_smile.gif
regular_smile.gif
sad_smile.gif
shades_smile.gif
teeth_smile.gif
thumbs_down.gif
thumbs_up.gif
tounge_smile.gif
whatchutalkingabout_smile.gif
wink_smile.gif
sourcearea
specialchar
stylescombo
tableresize
tabletools
template1.gif
template2.gif
template3.gif
hue_bg.png
hue_thumb.png
picker_mask.png
picker_thumb.png
uicolor.gif
ciframe.html
tmpFrameset.html
wysiwygarea
dialog_sides.gif
dialog_sides.png
dialog_sides_rtl.png
noimage.png
sprites.png
sprites_ie6.png
toolbar_start.gif
dialog.css
editor.css
elementspath.css
icons_rtl.png
mainui.css
presets.css
richcombo.css
templates.css
toolbar.css
office2003
dialog_sides.gif
dialog_sides.png
dialog_sides_rtl.png
noimage.png
sprites.png
sprites_ie6.png
dialog.css
editor.css
elementspath.css
icons_rtl.png
mainui.css
presets.css
richcombo.css
templates.css
toolbar.css
dialog_sides.gif
dialog_sides.png
dialog_sides_rtl.png
noimage.png
sprites.png
sprites_ie6.png
toolbar_start.gif
dialog.css
editor.css
elementspath.css
icons_rtl.png
mainui.css
presets.css
richcombo.css
templates.css
toolbar.css
CHANGES.html
ckeditor.pack
contents.css
INSTALL.html
LICENSE.html
arrow_ltr.png
arrow_rtl.png
asc_order.png
bd_browse.png
bd_deltbl.png
bd_drop.png
bd_empty.png
bd_firstpage.png
bd_ftext.png
bd_index.png
bd_insrow.png
bd_lastpage.png
bd_nextpage.png
bd_prevpage.png
bd_primary.png
bd_sbrowse.png
bd_select.png
bd_unique.png
b_bookmark.png
b_browse.png
b_calendar.png
b_comment.png
b_dbstatistics.png
b_deltbl.png
b_docs.png
b_docsql.png
b_drop.png
b_edit.png
b_empty.png
b_engine.png
b_export.png
b_firstpage.png
b_ftext.png
b_help.png
b_home.png
b_import.png
b_index.png
b_info.png
b_insrow.png
b_lastpage.png
b_minus.png
b_newdb.png
b_newtbl.png
b_nextpage.png
b_pdfdoc.png
b_plus.png
b_prevpage.png
b_primary.png
b_print.png
b_props.png
b_relations.png
b_save.png
b_sbrowse.png
b_search.png
b_selboard.png
b_select.png
b_sqldoc.png
b_sqlhelp.png
b_tblanalyse.png
b_tblexport.png
b_tblimport.png
b_tblops.png
b_tbloptimize.png
b_tipp.png
b_unique.png
b_usradd.png
b_usrcheck.png
b_usrdrop.png
b_usredit.png
b_usrlist.png
b_view.png
b_views.png
item_ltr.png
item_rtl.png
logo_left.png
logo_right.png
php_sym.png
pma_logo2.png
spacer.png
s_asci.png
s_attention.png
s_cancel.png
s_cancel2.png
s_desc.png
s_error.png
s_error2.png
s_fulltext.png
s_host.png
s_info.png
s_lang.png
s_loggoff.png
s_notice.png
s_okay.png
s_partialtext.png
s_passwd.png
s_process.png
s_really.png
s_reload.png
s_rights.png
s_status.png
s_theme.png
s_vars.png
s_views.png
s_warn.png
vertical_line.png
window-new.png
1maincss.css
b_browse.png
b_edit.png
b_insrow.png
leftcss.css
left_bg.gif
left_bg.png
maincss.css
topcss.css
combakfun.php
connect.php
bigdoc.html
bigdocutf.html
docutf.html
eadmin.php
eChangePath.php
eChangeTable.php
eDoSql.php
eindex.php
eListField.php
eSetDb.php
eadmin.php
eChangeDb.php
eDoSql.php
eDownZip.php
eindex.php
eListField.php
eSetDb.php
message.php
eChangeDb.php
eChangePath.php
eChangeTable.php
eDoSql.php
eindex.php
eListField.php
eRepFiletext.php
eadmin.php
eChangeDb.php
eChangePath.php
eDoSql.php
eDownZip.php
eindex.php
eListField.php
ChangeDb.php
ChangePath.php
DownZip.php
global.php
ListSetbak.php
index.html
install.html
article_management.php
article_published.php
global.php
index_left.php
index_top.php
safety.php
search.php
update.php
update_img.php
bg_footer.gif
bg_repno.gif
bg_repx.gif
bg_stepstatus.gif
stepnum.gif
index1.php
vdimgck.php
big_a5d30a6f044d75d743d325dbaf3c89.jpg
small_a5d30a6f044d75d743d325dbaf3c89.JPG
logo_web.gif
logo_web.gif
shouxie.gif
shouxie_index.gif
yuanso_com_gg1.gif
yuanso_com_gg2.gif
favicon.ico
index1.php
robots.txt
安装前必读.txt
版权声明.rtf
Copyright (c) , CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or /license
* @fileOverview Defines the {@link CKEDITOR.dom.element} class, which
represents a DOM element.
* Represents a DOM element.
* @constructor
* @augments CKEDITOR.dom.node
* @param {Object|String} element A native DOM element or the element name for
new elements.
* @param {CKEDITOR.dom.document} [ownerDocument] The document that will contain
the element in case of element creation.
* @example
* // Create a new &span& element.
* var element = new CKEDITOR.dom.element( &#39;span&#39; );
* @example
* // Create an element based on a native DOM element.
* var element = new CKEDITOR.dom.element( document.getElementById( &#39;myId&#39; ) );
CKEDITOR.dom.element = function( element, ownerDocument )
if ( typeof element == &#39;string&#39; )
element = ( ownerDocument ? ownerDocument.$ : document ).createElement( element );
// Call the base constructor (we must not call CKEDITOR.dom.node).
CKEDITOR.dom.domObject.call( this, element );
// PACKAGER_RENAME( CKEDITOR.dom.element )
* The the {@link CKEDITOR.dom.element} representing and element. If the
* element is a native DOM element, it will be transformed into a valid
* CKEDITOR.dom.element object.
* @returns {CKEDITOR.dom.element} The transformed element.
* @example
* var element = new CKEDITOR.dom.element( &#39;span&#39; );
* alert( element == &b&CKEDITOR.dom.element.get( element )&/b& );
* @example
* var element = document.getElementById( &#39;myElement&#39; );
* alert( &b&CKEDITOR.dom.element.get( element )&/b&.getName() );
CKEDITOR.dom.element.get = function( element )
return element && ( element.$ ? element : new CKEDITOR.dom.element( element ) );
CKEDITOR.dom.element.prototype = new CKEDITOR.dom.node();
* Creates an instance of the {@link CKEDITOR.dom.element} class based on the
* HTML representation of an element.
* @param {String} html The element HTML. It should define only one element in
the &root& level. The &root& element can have child nodes, but not
* @returns {CKEDITOR.dom.element} The element instance.
* @example
* var element = &b&CKEDITOR.dom.element.createFromHtml( &#39;&strong class=&anyclass&&My element&/strong&&#39; )&/b&;
* alert( element.getName() );
// &strong&
CKEDITOR.dom.element.createFromHtml = function( html, ownerDocument )
var temp = new CKEDITOR.dom.element( &#39;div&#39;, ownerDocument );
temp.setHtml( html );
// When returning the node, remove it from its parent to detach it.
return temp.getFirst().remove();
CKEDITOR.dom.element.setMarker = function( database, element, name, value )
var id = element.getCustomData( &#39;list_marker_id&#39; ) ||
( element.setCustomData( &#39;list_marker_id&#39;, CKEDITOR.tools.getNextNumber() ).getCustomData( &#39;list_marker_id&#39; ) ),
markerNames = element.getCustomData( &#39;list_marker_names&#39; ) ||
( element.setCustomData( &#39;list_marker_names&#39;, {} ).getCustomData( &#39;list_marker_names&#39; ) );
database[id] =
markerNames[name] = 1;
return element.setCustomData( name, value );
CKEDITOR.dom.element.clearAllMarkers = function( database )
for ( var i in database )
CKEDITOR.dom.element.clearMarkers( database, database[i], 1 );
CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatabase )
var names = element.getCustomData( &#39;list_marker_names&#39; ),
id = element.getCustomData( &#39;list_marker_id&#39; );
for ( var i in names )
element.removeCustomData( i );
element.removeCustomData( &#39;list_marker_names&#39; );
if ( removeFromDatabase )
element.removeCustomData( &#39;list_marker_id&#39; );
delete database[id];
CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype,
/** @lends CKEDITOR.dom.element.prototype */
* The node type. This is a constant value set to
* {@link CKEDITOR.NODE_ELEMENT}.
* @type Number
* @example
type : CKEDITOR.NODE_ELEMENT,
* Adds a CSS class to the element. It appends the class to the
* already existing names.
* @param {String} className The name of the class to be added.
* @example
* var element = new CKEDITOR.dom.element( &#39;div&#39; );
* element.addClass( &#39;classA&#39; );
// &div class=&classA&&
* element.addClass( &#39;classB&#39; );
// &div class=&classA classB&&
* element.addClass( &#39;classA&#39; );
// &div class=&classA classB&&
addClass : function( className )
var c = this.$.classN
var regex = new RegExp( &#39;(?:^|\\s)&#39; + className + &#39;(?:\\s|$)&#39;, &#39;&#39; );
if ( !regex.test( c ) )
c += &#39; &#39; + classN
this.$.className = c || classN
* Removes a CSS class name from the elements classes. Other classes
* remain untouched.
* @param {String} className The name of the class to remove.
* @example
* var element = new CKEDITOR.dom.element( &#39;div&#39; );
* element.addClass( &#39;classA&#39; );
// &div class=&classA&&
* element.addClass( &#39;classB&#39; );
// &div class=&classA classB&&
* element.removeClass( &#39;classA&#39; );
// &div class=&classB&&
* element.removeClass( &#39;classB&#39; );
removeClass : function( className )
var c = this.getAttribute( &#39;class&#39; );
var regex = new RegExp( &#39;(?:^|\\s+)&#39; + className + &#39;(?=\\s|$)&#39;, &#39;i&#39; );
if ( regex.test( c ) )
c = c.replace( regex, &#39;&#39; ).replace( /^\s+/, &#39;&#39; );
this.setAttribute( &#39;class&#39;, c );
this.removeAttribute( &#39;class&#39; );
hasClass : function( className )
var regex = new RegExp( &#39;(?:^|\\s+)&#39; + className + &#39;(?=\\s|$)&#39;, &#39;&#39; );
return regex.test( this.getAttribute(&#39;class&#39;) );
* Append a node as a child of this element.
* @param {CKEDITOR.dom.node|String} node The node or element name to be
* @param {Boolean} [toStart] Indicates that the element is to be
appended at the start.
* @returns {CKEDITOR.dom.node} The appended node.
* @example
* var p = new CKEDITOR.dom.element( &#39;p&#39; );
* var strong = new CKEDITOR.dom.element( &#39;strong&#39; );
* &b&p.append( strong );&/b&
* var em = &b&p.append( &#39;em&#39; );&/b&
* // result: &&p&&strong&&/strong&&em&&/em&&/p&&
append : function( node, toStart )
if ( typeof node == &#39;string&#39; )
node = this.getDocument().createElement( node );
if ( toStart )
this.$.insertBefore( node.$, this.$.firstChild );
this.$.appendChild( node.$ );
appendHtml : function( html )
if ( !this.$.childNodes.length )
this.setHtml( html );
var temp = new CKEDITOR.dom.element( &#39;div&#39;, this.getDocument() );
temp.setHtml( html );
temp.moveChildren( this );
* Append text to this element.
* @param {String} text The text to be appended.
* @returns {CKEDITOR.dom.node} The appended node.
* @example
* var p = new CKEDITOR.dom.element( &#39;p&#39; );
* p.appendText( &#39;This is&#39; );
* p.appendText( &#39; some text&#39; );
* // result: &&p&This is some text&/p&&
appendText : function( text )
if ( this.$.text != undefined )
this.$.text +=
this.append( new CKEDITOR.dom.text( text ) );
appendBogus : function()
var lastChild = this.getLast() ;
// Ignore empty/spaces text.
while ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.rtrim( lastChild.getText() ) )
lastChild = lastChild.getPrevious();
if ( !lastChild || !lastChild.is || !lastChild.is( &#39;br&#39; ) )
var bogus = CKEDITOR.env.opera ?
this.getDocument().createText(&#39;&#39;) :
this.getDocument().createElement( &#39;br&#39; );
CKEDITOR.env.gecko && bogus.setAttribute( &#39;type&#39;, &#39;_moz&#39; );
this.append( bogus );
* Breaks one of the ancestor element in the element position, moving
* this element between the broken parts.
* @param {CKEDITOR.dom.element} parent The anscestor element to get broken.
* @example
* // Before breaking:
&b&This &i&is some&span /& sample&/i& test text&/b&
* // If &element& is &span /& and &parent& is &i&:
&b&This &i&is some&/i&&span /&&i& sample&/i& test text&/b&
* element.breakParent( parent );
* @example
* // Before breaking:
&b&This &i&is some&span /& sample&/i& test text&/b&
* // If &element& is &span /& and &parent& is &b&:
&b&This &i&is some&/i&&/b&&span /&&b&&i& sample&/i& test text&/b&
* element.breakParent( parent );
breakParent : function( parent )
var range = new CKEDITOR.dom.range( this.getDocument() );
// We&#39;ll be extracting part of this element, so let&#39;s use our
// range to get the correct piece.
range.setStartAfter( this );
range.setEndAfter( parent );
// Extract it.
var docFrag = range.extractContents();
// Move the element outside the broken element.
range.insertNode( this.remove() );
// Re-insert the extracted piece after the element.
docFrag.insertAfterNode( this );
contains :
CKEDITOR.env.ie || CKEDITOR.env.webkit ?
function( node )
var $ = this.$;
return node.type != CKEDITOR.NODE_ELEMENT ?
$.contains( node.getParent().$ ) :
$ != node.$ && $.contains( node.$ );
function( node )
return !!( this.$.compareDocumentPosition( node.$ ) & 16 );
* Moves the selection focus to this element.
* @function
{Boolean} defer Whether to asynchronously defer the
execution by 100 ms.
* @example
* var element = CKEDITOR.document.getById( &#39;myTextarea&#39; );
* &b&element.focus()&/b&;
focus : ( function()
function exec()
// IE throws error if the element is not visible.
this.$.focus();
return function( defer )
if ( defer )
CKEDITOR.tools.setTimeout( exec, 100, this );
exec.call( this );
* Gets the inner HTML of this element.
* @returns {String} The inner HTML of this element.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&div&&b&Example&/b&&/div&&#39; );
* alert( &b&p.getHtml()&/b& );
// &&b&Example&/b&&
getHtml : function()
var retval = this.$.innerHTML;
// Strip &?xml:namespace& tags in IE. (#3341).
return CKEDITOR.env.ie ? retval.replace( /&\?[^&]*&/g, &#39;&#39; ) :
getOuterHtml : function()
if ( this.$.outerHTML )
// IE includes the &?xml:namespace& tag in the outerHTML of
// namespaced element. So, we must strip it here. (#3341)
return this.$.outerHTML.replace( /&\?[^&]*&/, &#39;&#39; );
var tmpDiv = this.$.ownerDocument.createElement( &#39;div&#39; );
tmpDiv.appendChild( this.$.cloneNode( true ) );
return tmpDiv.innerHTML;
* Sets the inner HTML of this element.
* @param {String} html The HTML to be set for this element.
* @returns {String} The inserted HTML.
* @example
* var p = new CKEDITOR.dom.element( &#39;p&#39; );
* &b&p.setHtml( &#39;&b&Inner&/b& HTML&#39; );&/b&
* // result: &&p&&b&Inner&/b& HTML&/p&&
setHtml : function( html )
return ( this.$.innerHTML = html );
* Sets the element contents as plain text.
* @param {String} text The text to be set.
* @returns {String} The inserted text.
* @example
* var element = new CKEDITOR.dom.element( &#39;div&#39; );
* element.setText( &#39;A & B & C & D&#39; );
* alert( element.innerHTML );
// &A & B & C & D&
setText : function( text )
CKEDITOR.dom.element.prototype.setText = ( this.$.innerText != undefined ) ?
function ( text )
return this.$.innerText =
function ( text )
return this.$.textContent =
return this.setText( text );
* Gets the value of an element attribute.
* @function
* @param {String} name The attribute name.
* @returns {String} The attribute value or null if not defined.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&input type=&text& /&&#39; );
* alert( &b&element.getAttribute( &#39;type&#39; )&/b& );
getAttribute : (function()
var standard = function( name )
return this.$.getAttribute( name, 2 );
if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
return function( name )
switch ( name )
case &#39;class&#39;:
name = &#39;className&#39;;
case &#39;tabindex&#39;:
var tabIndex = standard.call( this, name );
// IE returns tabIndex=0 by default for all
// elements. For those elements,
// getAtrribute( &#39;tabindex&#39;, 2 ) returns 32768
// instead. So, we must make this check to give a
// uniform result among all browsers.
if ( tabIndex !== 0 && this.$.tabIndex === 0 )
tabIndex =
return tabI
case &#39;checked&#39;:
var attr = this.$.attributes.getNamedItem( name ),
attrValue = attr.specified ? attr.nodeValue
// For value given by parser.
// For value created via DOM interface.
return attrValue ? &#39;checked&#39; :
case &#39;hspace&#39;:
case &#39;value&#39;:
return this.$[ name ];
case &#39;style&#39;:
// IE does not return inline styles via getAttribute(). See #2947.
return this.$.style.cssT
return standard.call( this, name );
getChildren : function()
return new CKEDITOR.dom.nodeList( this.$.childNodes );
* Gets the current computed value of one of the element CSS style
* properties.
* @function
* @param {String} propertyName The style property name.
* @returns {String} The property value.
* @example
* var element = new CKEDITOR.dom.element( &#39;span&#39; );
* alert( &b&element.getComputedStyle( &#39;display&#39; )&/b& );
// &inline&
getComputedStyle :
CKEDITOR.env.ie ?
function( propertyName )
return this.$.currentStyle[ CKEDITOR.tools.cssStyleToDomStyle( propertyName ) ];
function( propertyName )
return this.getWindow().$.getComputedStyle( this.$, &#39;&#39; ).getPropertyValue( propertyName );
* Gets the DTD entries for this element.
* @returns {Object} An object containing the list of elements accepted
by this element.
getDtd : function()
var dtd = CKEDITOR.dtd[ this.getName() ];
this.getDtd = function()
getElementsByTag : CKEDITOR.dom.document.prototype.getElementsByTag,
* Gets the computed tabindex for this element.
* @function
* @returns {Number} The tabindex value.
* @example
* var element = CKEDITOR.document.getById( &#39;myDiv&#39; );
* alert( &b&element.getTabIndex()&/b& );
// e.g. &-1&
getTabIndex :
CKEDITOR.env.ie ?
function()
var tabIndex = this.$.tabI
// IE returns tabIndex=0 by default for all elements. In
// those cases we must check that the element really has
// the tabindex attribute set to zero, or it is one of
// those element that should have zero by default.
if ( tabIndex === 0 && !CKEDITOR.dtd.$tabIndex[ this.getName() ] && parseInt( this.getAttribute( &#39;tabindex&#39; ), 10 ) !== 0 )
tabIndex = -1;
return tabI
: CKEDITOR.env.webkit ?
function()
var tabIndex = this.$.tabI
// Safari returns &undefined& for elements that should not
// have tabindex (like a div). So, we must try to get it
// from the attribute.
// https://bugs.webkit.org/show_bug.cgi?id=20596
if ( tabIndex == undefined )
tabIndex = parseInt( this.getAttribute( &#39;tabindex&#39; ), 10 );
// If the element don&#39;t have the tabindex attribute,
// then we should return -1.
if ( isNaN( tabIndex ) )
tabIndex = -1;
return tabI
function()
return this.$.tabI
* Gets the text value of this element.
* Only in IE (which uses innerText), &br& will cause linebreaks,
* and sucessive whitespaces (including line breaks) will be reduced to
* a single space. This behavior is ok for us, for now. It may change
* in the future.
* @returns {String} The text value.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&div&Same &i&text&/i&.&/div&&#39; );
* alert( &b&element.getText()&/b& );
// &Sample text.&
getText : function()
return this.$.textContent || this.$.innerText || &#39;&#39;;
* Gets the window object that contains this element.
* @returns {CKEDITOR.dom.window} The window object.
* @example
getWindow : function()
return this.getDocument().getWindow();
* Gets the value of the &id& attribute of this element.
* @returns {String} The element id, or null if not available.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&p id=&myId&&&/p&&#39; );
* alert( &b&element.getId()&/b& );
getId : function()
return this.$.id ||
* Gets the value of the &name& attribute of this element.
* @returns {String} The element name, or null if not available.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&input name=&myName&&&/input&&#39; );
* alert( &b&element.getNameAtt()&/b& );
// &myName&
getNameAtt : function()
return this.$.name ||
* Gets the element name (tag name). The returned name is guaranteed to
* be always full lowercased.
* @returns {String} The element name.
* @example
* var element = new CKEDITOR.dom.element( &#39;span&#39; );
* alert( &b&element.getName()&/b& );
getName : function()
// Cache the lowercased name inside a closure.
var nodeName = this.$.nodeName.toLowerCase();
if ( CKEDITOR.env.ie && ! ( document.documentMode & 8 ) )
var scopeName = this.$.scopeN
if ( scopeName != &#39;HTML&#39; )
nodeName = scopeName.toLowerCase() + &#39;:&#39; + nodeN
this.getName = function()
return nodeN
* Gets the value set to this element. This value is usually available
* for form field elements.
* @returns {String} The element value.
getValue : function()
return this.$.
* Gets the first child node of this element.
* @param {Function} evaluator Filtering the result node.
* @returns {CKEDITOR.dom.node} The first child node or null if not
available.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&div&&b&Example&/b&&/div&&#39; );
* var first = &b&element.getFirst()&/b&;
* alert( first.getName() );
getFirst : function( evaluator )
var first = this.$.firstChild,
retval = first && new CKEDITOR.dom.node( first );
if ( retval && evaluator && !evaluator( retval ) )
retval = retval.getNext( evaluator );
* @param {Function} evaluator Filtering the result node.
getLast : function( evaluator )
var last = this.$.lastChild,
retval = last && new CKEDITOR.dom.node( last );
if ( retval && evaluator && !evaluator( retval ) )
retval = retval.getPrevious( evaluator );
getStyle : function( name )
return this.$.style[ CKEDITOR.tools.cssStyleToDomStyle( name ) ];
* Checks if the element name matches one or more names.
* @param {String} name[,name[,...]] One or more names to be checked.
* @returns {Boolean} true if the element name matches any of the names.
* @example
* var element = new CKEDITOR.element( &#39;span&#39; );
* alert( &b&element.is( &#39;span&#39; )&/b& );
* alert( &b&element.is( &#39;p&#39;, &#39;span&#39; )&/b& );
* alert( &b&element.is( &#39;p&#39; )&/b& );
* alert( &b&element.is( &#39;p&#39;, &#39;div&#39; )&/b& );
is : function()
var name = this.getName();
for ( var i = 0 ; i & arguments. i++ )
if ( arguments[ i ] == name )
isEditable : function()
// Get the element name.
var name = this.getName();
// Get the element DTD (defaults to span for unknown elements).
var dtd = !CKEDITOR.dtd.$nonEditable[ name ]
&& ( CKEDITOR.dtd[ name ] || CKEDITOR.dtd.span );
// In the DTD # == text node.
return ( dtd && dtd[&#39;#&#39;] );
isIdentical : function( otherElement )
if ( this.getName() != otherElement.getName() )
var thisAttribs = this.$.attributes,
otherAttribs = otherElement.$.
var thisLength = thisAttribs.length,
otherLength = otherAttribs.
for ( var i = 0 ; i & thisL i++ )
var attribute = thisAttribs[ i ];
if ( attribute.nodeName == &#39;_moz_dirty&#39; )
if ( ( !CKEDITOR.env.ie || ( attribute.specified && attribute.nodeName != &#39;data-cke-expando&#39; ) ) && attribute.nodeValue != otherElement.getAttribute( attribute.nodeName ) )
// For IE, we have to for both elements, because it&#39;s difficult to
// know how the atttibutes collection is organized in its DOM.
if ( CKEDITOR.env.ie )
for ( i = 0 ; i & otherL i++ )
attribute = otherAttribs[ i ];
if ( attribute.specified && attribute.nodeName != &#39;data-cke-expando&#39;
&& attribute.nodeValue != this.getAttribute( attribute.nodeName ) )
* Checks if this element is visible. May not work if the element is
* child of an element with visibility set to &hidden&, but works well
* on the great majority of cases.
* @return {Boolean} True if the element is visible.
isVisible : function()
var isVisible = !!this.$.offsetHeight && this.getComputedStyle( &#39;visibility&#39; ) != &#39;hidden&#39;,
elementWindow,
elementWindowF
// Webkit and Opera report non-zero offsetHeight despite that
// element is inside an invisible iframe. (#4542)
if ( isVisible && ( CKEDITOR.env.webkit || CKEDITOR.env.opera ) )
elementWindow = this.getWindow();
if ( !elementWindow.equals( CKEDITOR.document.getWindow() )
&& ( elementWindowFrame = elementWindow.$.frameElement ) )
isVisible = new CKEDITOR.dom.element( elementWindowFrame ).isVisible();
return isV
* Whether it&#39;s an empty inline elements which has no visual impact when removed.
isEmptyInlineRemoveable : function()
if ( !CKEDITOR.dtd.$removeEmpty[ this.getName() ] )
var children = this.getChildren();
for ( var i = 0, count = children.count(); i & i++ )
var child = children.getItem( i );
if ( child.type == CKEDITOR.NODE_ELEMENT && child.data( &#39;cke-bookmark&#39; ) )
if ( child.type == CKEDITOR.NODE_ELEMENT && !child.isEmptyInlineRemoveable()
|| child.type == CKEDITOR.NODE_TEXT && CKEDITOR.tools.trim( child.getText() ) )
* Checks if the element has any defined attributes.
* @function
* @returns {Boolean} True if the element has attributes.
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&div title=&Test&&Example&/div&&#39; );
* alert( &b&element.hasAttributes()&/b& );
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&div&Example&/div&&#39; );
* alert( &b&element.hasAttributes()&/b& );
// &false&
hasAttributes :
CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) ?
function()
var attributes = this.$.
for ( var i = 0 ; i & attributes. i++ )
var attribute = attributes[i];
switch ( attribute.nodeName )
case &#39;class&#39; :
// IE has a strange bug. If calling removeAttribute(&#39;className&#39;),
// the attributes collection will still contain the &class&
// attribute, which will be marked as &specified&, even if the
// outerHTML of the element is not displaying the class attribute.
// Note : I was not able to reproduce it outside the editor,
// but I&#39;ve faced it while working on the TC of #1391.
if ( this.getAttribute( &#39;class&#39; ) )
// Attributes to be ignored.
case &#39;data-cke-expando&#39; :
/*jsl:fallthru*/
if ( attribute.specified )
function()
var attrs = this.$.attributes,
attrsNum = attrs.
// The _moz_dirty attribute might get into the element after pasting (#5455)
var execludeAttrs = { &#39;data-cke-expando&#39; : 1, _moz_dirty : 1 };
return attrsNum & 0 &&
( attrsNum & 2 ||
!execludeAttrs[ attrs[0].nodeName ] ||
( attrsNum == 2 && !execludeAttrs[ attrs[1].nodeName ] ) );
* Checks if the specified attribute is defined for this element.
* @returns {Boolean} True if the specified attribute is defined.
* @param {String} name The attribute name.
* @example
hasAttribute : function( name )
var $attr = this.$.attributes.getNamedItem( name );
return !!( $attr && $attr.specified );
* Hides this element (display:none).
* @example
* var element = CKEDITOR.dom.element.getById( &#39;myElement&#39; );
* &b&element.hide()&/b&;
hide : function()
this.setStyle( &#39;display&#39;, &#39;none&#39; );
moveChildren : function( target, toStart )
var $ = this.$;
target = target.$;
if ( $ == target )
if ( toStart )
while ( ( child = $.lastChild ) )
target.insertBefore( $.removeChild( child ), target.firstChild );
while ( ( child = $.firstChild ) )
target.appendChild( $.removeChild( child ) );
* Merges sibling elements that are identical to this one.&br&
* Identical child elements are also merged. For example:&br&
* &b&&i&&/i&&/b&&b&&i&&/i&&/b& =& &b&&i&&/i&&/b&
* @function
* @param {Boolean} [inlineOnly] Allow only inline elements to be merged. Defaults to &true&.
mergeSiblings : ( function()
function mergeElements( element, sibling, isNext )
if ( sibling && sibling.type == CKEDITOR.NODE_ELEMENT )
// Jumping over bookmark nodes and empty inline elements, e.g. &b&&i&&/i&&/b&,
// queuing them to be moved later. (#5567)
var pendingNodes = [];
while ( sibling.data( &#39;cke-bookmark&#39; )
|| sibling.isEmptyInlineRemoveable() )
pendingNodes.push( sibling );
sibling = isNext ? sibling.getNext() : sibling.getPrevious();
if ( !sibling || sibling.type != CKEDITOR.NODE_ELEMENT )
if ( element.isIdentical( sibling ) )
// Save the last child to be checked too, to merge things like
// &b&&i&&/i&&/b&&b&&i&&/i&&/b& =& &b&&i&&/i&&/b&
var innerSibling = isNext ? element.getLast() : element.getFirst();
// Move pending nodes first into the target element.
while( pendingNodes.length )
pendingNodes.shift().move( element, !isNext );
sibling.moveChildren( element, !isNext );
sibling.remove();
// Now check the last inner child (see two comments above).
if ( innerSibling && innerSibling.type == CKEDITOR.NODE_ELEMENT )
innerSibling.mergeSiblings();
return function( inlineOnly )
if ( ! ( inlineOnly === false
|| CKEDITOR.dtd.$removeEmpty[ this.getName() ]
|| this.is( &#39;a&#39; ) ) ) // Merge empty links and anchors also. (#5567)
mergeElements( this, this.getNext(), true );
mergeElements( this, this.getPrevious() );
* Shows this element (display it).
* @example
* var element = CKEDITOR.dom.element.getById( &#39;myElement&#39; );
* &b&element.show()&/b&;
show : function()
this.setStyles(
display : &#39;&#39;,
visibility : &#39;&#39;
* Sets the value of an element attribute.
* @param {String} name The name of the attribute.
* @param {String} value The value to be set to the attribute.
* @function
* @returns {CKEDITOR.dom.element} This element instance.
* @example
* var element = CKEDITOR.dom.element.getById( &#39;myElement&#39; );
* &b&element.setAttribute( &#39;class&#39;, &#39;myClass&#39; )&/b&;
* &b&element.setAttribute( &#39;title&#39;, &#39;This is an example&#39; )&/b&;
setAttribute : (function()
var standard = function( name, value )
this.$.setAttribute( name, value );
if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
return function( name, value )
if ( name == &#39;class&#39; )
this.$.className =
else if ( name == &#39;style&#39; )
this.$.style.cssText =
else if ( name == &#39;tabindex&#39; ) // Case sensitive.
this.$.tabIndex =
else if ( name == &#39;checked&#39; )
this.$.checked =
standard.apply( this, arguments );
* Sets the value of several element attributes.
* @param {Object} attributesPairs An object containing the names and
values of the attributes.
* @returns {CKEDITOR.dom.element} This element instance.
* @example
* var element = CKEDITOR.dom.element.getById( &#39;myElement&#39; );
* &b&element.setAttributes({
&#39;class&#39; : &#39;myClass&#39;,
&#39;title&#39; : &#39;This is an example&#39; })&/b&;
setAttributes : function( attributesPairs )
for ( var name in attributesPairs )
this.setAttribute( name, attributesPairs[ name ] );
* Sets the element value. This function is usually used with form
* field element.
* @param {String} value The element value.
* @returns {CKEDITOR.dom.element} This element instance.
setValue : function( value )
this.$.value =
* Removes an attribute from the element.
* @param {String} name The attribute name.
* @function
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&div class=&classA&&&/div&&#39; );
* element.removeAttribute( &#39;class&#39; );
removeAttribute : (function()
var standard = function( name )
this.$.removeAttribute( name );
if ( CKEDITOR.env.ie && ( CKEDITOR.env.ie7Compat || CKEDITOR.env.ie6Compat ) )
return function( name )
if ( name == &#39;class&#39; )
name = &#39;className&#39;;
else if ( name == &#39;tabindex&#39; )
name = &#39;tabIndex&#39;;
standard.call( this, name );
removeAttributes : function ( attributes )
if ( CKEDITOR.tools.isArray( attributes ) )
for ( var i = 0 ; i & attributes. i++ )
this.removeAttribute( attributes[ i ] );
for ( var attr in attributes )
attributes.hasOwnProperty( attr ) && this.removeAttribute( attr );
* Removes a style from the element.
* @param {String} name The style name.
* @function
* @example
* var element = CKEDITOR.dom.element.createFromHtml( &#39;&div style=&display:none&&&/div&&#39; );
* element.removeStyle( &#39;display&#39; );
removeStyle : function( name )
this.setStyle( name, &#39;&#39; );
if ( this.$.style.removeAttribute )
this.$.style.removeAttribute( CKEDITOR.tools.cssStyleToDomStyle( name ) );
if ( !this.$.style.cssText )
this.removeAttribute( &#39;style&#39; );
* Sets the value of an element style.
* @param {String} name The name of the style. The CSS naming notation
must be used (e.g. &background-color&).
* @param {String} value The value to be set to the style.
* @returns {CKEDITOR.dom.element} This element instance.
* @example
* var element = CKEDITOR.dom.element.getById( &#39;myElement&#39; );
* &b&element.setStyle( &#39;background-color&#39;, &#39;#ff0000&#39; )&/b&;
* &b&element.setStyle( &#39;margin-top&#39;, &#39;10px&#39; )&/b&;
* &b&element.setStyle( &#39;float&#39;, &#39;right&#39; )&/b&;
setStyle : function( name, value )
this.$.style[ CKEDITOR.tools.cssStyleToDomStyle( name ) ] =
* Sets the value of several element styles.
* @param {Object} stylesPairs An object containing the names and
values of the styles.
* @returns {CKEDITOR.dom.element} This element instance.
* @example
* var element = CKEDITOR.dom.element.getById( &#39;myElement&#39; );
* &b&element.setStyles({
&#39;position&#39; : &#39;absolute&#39;,
&#39;float&#39; : &#39;right&#39; })&/b&;
setStyles : function( stylesPairs )
for ( var name in stylesPairs )
this.setStyle( name, stylesPairs[ name ] );
* Sets the opacity of an element.
* @param {Number} opacity A number within the range [0.0, 1.0].
* @example
* var element = CKEDITOR.dom.element.getById( &#39;myElement&#39; );
* &b&element.setOpacity( 0.75 )&/b&;
setOpacity : function( opacity )
if ( CKEDITOR.env.ie )
opacity = Math.round( opacity * 100 );
this.setStyle( &#39;filter&#39;, opacity &= 100 ? &#39;&#39; : &#39;progid:DXImageTransform.Microsoft.Alpha(opacity=&#39; + opacity + &#39;)&#39; );
this.setStyle( &#39;opacity&#39;, opacity );
* Makes the element and its children unselectable.
* @function
* @example
* var element = CKEDITOR.dom.element.getById( &#39;myElement&#39; );
* element.unselectable();
unselectable :
CKEDITOR.env.gecko ?
function()
this.$.style.MozUserSelect = &#39;none&#39;;
this.on( &#39;dragstart&#39;, function( evt ) { evt.data.preventDefault(); } );
: CKEDITOR.env.webkit ?
function()
this.$.style.KhtmlUserSelect = &#39;none&#39;;
this.on( &#39;dragstart&#39;, function( evt ) { evt.data.preventDefault(); } );
function()
if ( CKEDITOR.env.ie || CKEDITOR.env.opera )
var element = this.$,
element.unselectable = &#39;on&#39;;
while ( ( e = element.all[ i++ ] ) )
switch ( e.tagName.toLowerCase() )
case &#39;iframe&#39; :
case &#39;textarea&#39; :
case &#39;input&#39; :
case &#39;select&#39; :
/* Ignore the above tags */
e.unselectable = &#39;on&#39;;
getPositionedAncestor : function()
var current =
while ( current.getName() != &#39;html&#39; )
if ( current.getComputedStyle( &#39;position&#39; ) != &#39;static&#39; )
current = current.getParent();
getDocumentPosition : function( refDocument )
var x = 0, y = 0,
body = this.getDocument().getBody(),
quirks = this.getDocument().$.compatMode == &#39;BackCompat&#39;;
var doc = this.getDocument();
if ( document.documentElement[ &getBoundingClientRect& ] )
= this.$.getBoundingClientRect(),
$doc = doc.$,
$docElem = $doc.documentE
var clientTop = $docElem.clientTop || body.$.clientTop || 0,
clientLeft = $docElem.clientLeft || body.$.clientLeft || 0,
needAdjustScrollAndBorders =
* #3804: getBoundingClientRect() works differently on IE and non-IE
* browsers, regarding scroll positions.
* On IE, the top position of the &html& element is always 0, no matter
* how much you scrolled down.
* On other browsers, the top position of the &html& element is negative
* scrollTop.
if ( CKEDITOR.env.ie )
var inDocElem = doc.getDocumentElement().contains( this ),
inBody = doc.getBody().contains( this );
needAdjustScrollAndBorders = ( quirks && inBody ) || ( !quirks && inDocElem );
if ( needAdjustScrollAndBorders )
x = box.left + ( !quirks && $docElem.scrollLeft || body.$.scrollLeft );
x -= clientL
y = box.top
+ ( !quirks && $docElem.scrollTop || body.$.scrollTop );
y -= clientT
var current = this, previous = null, offsetP
while ( current && !( current.getName() == &#39;body&#39; || current.getName() == &#39;html&#39; ) )
x += current.$.offsetLeft - current.$.scrollL
y += current.$.offsetTop - current.$.scrollT
// Opera includes clientTop|Left into offsetTop|Left.
if ( !current.equals( this ) )
x += ( current.$.clientLeft || 0 );
y += ( current.$.clientTop || 0 );
var scrollElement =
while ( scrollElement && !scrollElement.equals( current ) )
x -= scrollElement.$.scrollL
y -= scrollElement.$.scrollT
scrollElement = scrollElement.getParent();
previous =
current = ( offsetParent = current.$.offsetParent ) ?
new CKEDITOR.dom.element( offsetParent ) :
if ( refDocument )
var currentWindow = this.getWindow(),
refWindow = refDocument.getWindow();
if ( !currentWindow.equals( refWindow ) && currentWindow.$.frameElement )
var iframePosition = ( new CKEDITOR.dom.element( currentWindow.$.frameElement ) ).getDocumentPosition( refDocument );
x += iframePosition.x;
y += iframePosition.y;
if ( !document.documentElement[ &getBoundingClientRect& ] )
// In Firefox, we&#39;ll endup one pixel before the element positions,
// so we must add it here.
if ( CKEDITOR.env.gecko && !quirks )
x += this.$.clientLeft ? 1 : 0;
y += this.$.clientTop ? 1 : 0;
return { x : x, y : y };
scrollIntoView : function( alignTop )
// Get the element window.
var win = this.getWindow(),
winHeight = win.getViewPaneSize().
// Starts from the offset that will be scrolled with the negative value of
// the visible window height.
var offset = winHeight * -1;
// Append the view pane&#39;s height if align to top.
// Append element height if we are aligning to the bottom.
if ( alignTop )
offset += winH
offset += this.$.offsetHeight || 0;
// Consider the margin in the scroll, which is ok for our current needs, but
// needs investigation if we will be using this function in other places.
offset += parseInt( this.getComputedStyle( &#39;marginBottom&#39; ) || 0, 10 ) || 0;
// Append the offsets for the entire element hierarchy.
var elementPosition = this.getDocumentPosition();
offset += elementPosition.y;
// offset value might be out of range(nagative), fix it(#3692).
offset = offset & 0 ? 0 :
// Scroll the window to the desired position, if not already visible(#3795).
var currentScroll = win.getScrollPosition().y;
if ( offset & currentScroll || offset & currentScroll - winHeight )
win.$.scrollTo( 0, offset );
setState : function( state )
switch ( state )
case CKEDITOR.TRISTATE_ON :
this.addClass( &#39;cke_on&#39; );
this.removeClass( &#39;cke_off&#39; );
this.removeClass( &#39;cke_disabled&#39; );
case CKEDITOR.TRISTATE_DISABLED :
this.addClass( &#39;cke_disabled&#39; );
this.removeClass( &#39;cke_off&#39; );
this.removeClass( &#39;cke_on&#39; );
this.addClass( &#39;cke_off&#39; );
this.removeClass( &#39;cke_on&#39; );
this.removeClass( &#39;cke_disabled&#39; );
* Returns the inner document of this IFRAME element.
* @returns {CKEDITOR.dom.document} The inner document.
getFrameDocument : function()
var $ = this.$;
// In IE, with custom document.domain, it may happen that
// the iframe is not yet available, resulting in &Access
// Denied& for the following property access.
$.contentWindow.
catch ( e )
// Trick to solve this issue, forcing the iframe to get ready
// by simply setting its &src& property.
$.src = $.
// In IE6 though, the above is not enough, so we must pause the
// execution for a while, giving it time to think.
if ( CKEDITOR.env.ie && CKEDITOR.env.version & 7 )
window.showModalDialog(
&#39;javascript:document.write(&&#39; +
&#39;&script&&#39; +
&#39;window.setTimeout(&#39; +
&#39;function(){window.close();}&#39; +
&#39;,50);&#39; +
&#39;&/script&&)&#39; );
return $ && new CKEDITOR.dom.document( $.contentWindow.document );
* Copy all the attributes from one node to the other, kinda like a clone
* skipAttributes is an object with the attributes that must NOT be copied.
* @param {CKEDITOR.dom.element} dest The destination element.
* @param {Object} skipAttributes A dictionary of attributes to skip.
* @example
copyAttributes : function( dest, skipAttributes )
var attributes = this.$.
skipAttributes = skipAttributes || {};
for ( var n = 0 ; n & attributes. n++ )
var attribute = attributes[n];
// Lowercase attribute name hard rule is broken for
// some attribute on IE, e.g. CHECKED.
var attrName = attribute.nodeName.toLowerCase(),
// We can set the type only once, so do it with the proper value, not copying it.
if ( attrName in skipAttributes )
if ( attrName == &#39;checked&#39; && ( attrValue = this.getAttribute( attrName ) ) )
dest.setAttribute( attrName, attrValue );
// IE BUG: value attribute is never specified even if it exists.
else if ( attribute.specified ||
( CKEDITOR.env.ie && attribute.nodeValue && attrName == &#39;value&#39; ) )
attrValue = this.getAttribute( attrName );
if ( attrValue === null )
attrValue = attribute.nodeV
dest.setAttribute( attrName, attrValue );
// The style:
if ( this.$.style.cssText !== &#39;&#39; )
dest.$.style.cssText = this.$.style.cssT
* Changes the tag name of the current element.
* @param {String} newTag The new tag for the element.
renameNode : function( newTag )
// If it&#39;s already correct exit here.
if ( this.getName() == newTag )
var doc = this.getDocument();
// Create the new node.
var newNode = new CKEDITOR.dom.element( newTag, doc );
// Copy all attributes.
this.copyAttributes( newNode );
// Move children to the new node.
this.moveChildren( newNode );
// Replace the node.
this.getParent() && this.$.parentNode.replaceChild( newNode.$, this.$ );
newNode.$[ &#39;data-cke-expando&#39; ] = this.$[ &#39;data-cke-expando&#39; ];
this.$ = newNode.$;
* Gets a DOM tree descendant under the current node.
* @param {Array|Number} indices The child index or array of child indices under the node.
* @returns {CKEDITOR.dom.node} The specified DOM child under the current node. Null if child does not exist.
* @example
* var strong = p.getChild(0);
getChild : function( indices )
var rawNode = this.$;
if ( !indices.slice )
rawNode = rawNode.childNodes[ indices ];
while ( indices.length & 0 && rawNode )
rawNode = rawNode.childNodes[ indices.shift() ];
return rawNode ? new CKEDITOR.dom.node( rawNode ) :
getChildCount : function()
return this.$.childNodes.
disableContextMenu : function()
this.on( &#39;contextmenu&#39;, function( event )
// Cancel the browser context menu.
if ( !event.data.getTarget().hasClass( &#39;cke_enable_context_menu&#39; ) )
event.data.preventDefault();
* Gets element&#39;s direction. Supports both CSS &#39;direction&#39; prop and &#39;dir&#39; attr.
getDirection : function( useComputed )
return useComputed ? this.getComputedStyle( &#39;direction&#39; ) : this.getStyle( &#39;direction&#39; ) || this.getAttribute( &#39;dir&#39; );
* Gets, sets and removes custom data to be stored as HTML5 data-* attributes.
* @param {String} name The name of the attribute, excluding the &#39;data-&#39; part.
* @param {String} [value] The value to set. If set to false, the attribute will be removed.
* @example
* element.data( &#39;extra-info&#39;, &#39;test&#39; );
// appended the attribute data-extra-info=&test& to the element
* alert( element.data( &#39;extra-info&#39; ) );
* element.data( &#39;extra-info&#39;, false );
// remove the data-extra-info attribute from the element
data : function ( name, value )
name = &#39;data-&#39; +
if ( value === undefined )
return this.getAttribute( name );
else if ( value === false )
this.removeAttribute( name );
this.setAttribute( name, value );
( function()
var sides = {
width : [ &border-left-width&, &border-right-width&,&padding-left&, &padding-right& ],
height : [ &border-top-width&, &border-bottom-width&, &padding-top&,
&padding-bottom& ]
function marginAndPaddingSize( type )
var adjustment = 0;
for ( var i = 0, len = sides[ type ]. i & i++ )
adjustment += parseInt( this.getComputedStyle( sides [ type ][ i ] ) || 0, 10 ) || 0;
* Sets the element size considering the box model.
* @name CKEDITOR.dom.element.prototype.setSize
* @function
* @param {String} type The dimension to set. It accepts &width& and &height&.
* @param {Number} size The length unit in px.
* @param {Boolean} isBorderBox Apply the size based on the border box model.
CKEDITOR.dom.element.prototype.setSize = function( type, size, isBorderBox )
if ( typeof size == &#39;number&#39; )
if ( isBorderBox && !( CKEDITOR.env.ie && CKEDITOR.env.quirks ) )
size -= marginAndPaddingSize.call( this, type );
this.setStyle( type, size + &#39;px&#39; );
* Gets the element size, possibly considering the box model.
* @name CKEDITOR.dom.element.prototype.getSize
* @function
* @param {String} type The dimension to get. It accepts &width& and &height&.
* @param {Boolean} isBorderBox Get the size based on the border box model.
CKEDITOR.dom.element.prototype.getSize = function( type, isBorderBox )
var size = Math.max( this.$[ &#39;offset&#39; + CKEDITOR.tools.capitalize( type )
this.$[ &#39;client&#39; + CKEDITOR.tools.capitalize( type )
if ( isBorderBox )
size -= marginAndPaddingSize.call( this, type );
Copyright(C)
OKBASE.NET All Rights Reserved 好库网 版权所有

我要回帖

更多关于 jaxb xmlanyelement 的文章

 

随机推荐