Search completed in 1.08 seconds.
RTCDataChannel - Web APIs
the rt
cdatachannel interface represents a network channel which can be used for bidirectional peer-to-peer transfers of arbitrary data.
...the peer being invited to exchange data receives a datachannel event (which has type rt
cdatachannelevent) to let it know the data channel has been added to the connection.
... propertiesalso inherits properties from: eventtargetbinarytype the property binarytype on the rt
cdatachannel interface is a domstring which specifies the type of javascript object which should be used to represent binary data received on the rt
cdatachannel.
...And 13 more matches
CData
a
cdata object represents a c value or function located in memory.
... method overview methods available on all
cdata objects
cdata address() string tosource() string tostring() properties properties of all
cdata objects property type description constructor ctype the data type of the
cdata object, as a ctype.
... value object the javascript equivalent of the
cdata object's value.
...And 7 more matches
CDATASection - Web APIs
the
cdatasection interface represents a
cdata section that can be used within xml to include extended portions of unescaped text.
... the symbols < and & don’t need escaping as they normally do when inside a
cdata section.
... in xml, a
cdata section looks like: <![
cdata[ ...
...And 7 more matches
A simple RTCDataChannel sample - Web APIs
the rt
cdatachannel interface is a feature of the webrtc api which lets you open a channel between two peers over which you may send and receive arbitrary data.
... in this example, we will open an rt
cdatachannel connection linking two elements on the same page.
... the next step is to create the rt
cdatachannel by calling rtcpeerconnection.createdatachannel() and set up event listeners to monitor the channel so that we know when it's opened and closed (that is, when the channel is connected or disconnected within that peer connection).
...And 7 more matches
RTCDataChannelEvent - Web APIs
the rt
cdatachannelevent() constructor returns a new rt
cdatachannelevent object, which represents a datachannel event.
... these events sent to an rtcpeerconnection when its remote peer is asking to open an rt
cdatachannel between the two peers.
... you will rarely if ever construct an rt
cdatachannelevent by hand; instead, the webrtc layer will generate and deliver them to you at the appropriate time.
...And 5 more matches
RTCDataChannel.close() - Web APIs
the rt
cdatachannel.close() method closes the rt
cdatachannel.
... the sequence of events which occurs in response to this method being called: rt
cdatachannel.readystate is set to "closing".
... the rt
cdatachannel.readystate property is set to "closed".
...And 4 more matches
RTCDataChannelEvent() - Web APIs
the rt
cdatachannelevent() constructor creates a new rt
cdatachannelevent.
... you will rarely if ever construct an rt
cdatachannelevent by hand; these events are normally created and sent by the webrtc layer itself.
... syntax var event = new rt
cdatachannelevent(type, rt
cdatachanneleventinit); parameters type a domstring which specifies the name of the event.
...And 4 more matches
Document.createCDATASection() - Web APIs
create
cdatasection() creates a new
cdata section node, and returns it.
... syntax var
cdatasectionnode = document.create
cdatasection(data);
cdatasectionnode is a
cdata section node.
... data is a string containing the data to be added to the
cdata section.
...And 3 more matches
RTCDataChannel.readyState - Web APIs
the read-only rt
cdatachannel property readystate returns an enum of type rt
cdatachannelstate which indicates the state of the data channel's underlying data connection.
... syntax var state = adatachannel.readystate; values a string which is one of the values in the rt
cdatachannelstate enum, indicating the current state of the underlying data transport.
... rt
cdatachannelstate enum the rt
cdatachannelstate enum defines string constants which reflect the current status of the rt
cdatachannel's underlying data connection.
...And 3 more matches
RTCDataChannel.onclosing - Web APIs
the rt
cdatachannel.onclosing property is an eventhandler which specifies a function to be called by the browser when the closing event is received by the rt
cdatachannel.
... this is a simple event which indicates that the data channel is being closed, that is, rt
cdatachannel transitions to "closing" state.
... for example, after rt
cdatachannel.close() was called but the underlying data transport might not have been closed yet.
...And 2 more matches
RTCDataChannel.onbufferedamountlow - Web APIs
the rt
cdatachannel.onbufferedamountlow property is an eventhandler which specifies a function the browser calls when the bufferedamountlow event is sent to the rt
cdatachannel.
... syntax rt
cdatachannel.onbufferedamountlow = function; value a function which the browser will call to handle the bufferedamountlow event.
... example this example responds to the bufferedamountlow event by fetching up to 64kb of a file represented by an object source and calling rt
cdatachannel.send() to queue up the retrieved data for sending on the data channel.
...*/ dc.onbufferedamountlow = function() { if (source.position <= source.length) { dc.send(source.readfile(65536)); } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.onbufferedamountlow' in that specification.
RTCDataChannel.send() - Web APIs
the send() method of the rt
cdatachannel interface sends data across the data channel to the remote peer.
... syntax rt
cdatachannel.send(data); parameters data the data to transmit across the connection.
... example in this example, a routine called sendmessage() is created; it accepts an object as input and sends to the remote peer, over the rt
cdatachannel, a json string with the specified object and a time stamp.
... var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("backchannel"); function sendmessage(msg) { let obj = { "message": msg, "timestamp": new date() } dc.send(json.stringify(obj)); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.send()' in that specification.
RTCDataChannel.bufferedAmount - Web APIs
the read-only rt
cdatachannel property bufferedamount returns the number of bytes of data currently queued to be sent over the data channel.
... example the snippet below includes a function which changes the contents of a block with the id "buffersize" to a string indicating the number of bytes currently buffered on an rt
cdatachannel.
...*/ function showbufferedamount(channel) { let el = document.getelementbyid("buffersize"); el.innerhtml = channel.bufferedamount + " bytes"; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.bufferedamount' in that specification.
RTCDataChannel.bufferedAmountLowThreshold - Web APIs
the rt
cdatachannel property bufferedamountlowthreshold is used to specify the number of bytes of buffered outgoing data that is considered "low." the default value is 0.
... syntax var threshold = adatachannel.bufferedamountlowthreshold; adatachannel.bufferedamountlowthreshold = threshold; value the number of queued outgoing data bytes below which the buffer is considered to be "low." example in this snippet of code, bufferedamountlowthreshold is set to 64kb, and a handler for the bufferedamountlow event is established by setting the rt
cdatachannel.onbufferedamountlow property to a function which should send more data into the buffer by calling send().
... var dc = peerconnection.createdatachannel("file transfer"); dc.bufferedamountlowthreshold = 65535; dc.onbufferedamountlow = function() { /* use send() to queue more data to be sent */ }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.bufferedamountlowthreshold' in that specification.
RTCDataChannel: close event - Web APIs
the close event is sent to the onclose event handler on an rt
cdatachannel instance when the data transport being used for the data channel has closed.
... before any further data can be transferred using rt
cdatachannel, a new data channel instance must be created.
... bubbles no cancelable no interface event event handler property rt
cdatachannel.onclose examples this example sets up a handler for the close event for the rt
cdatachannel named dc; its responsibility in this example is to update user interface elements to reflect that there is no longer an ongoing call, and to allow a new call to be started.
RTCDataChannel.id - Web APIs
the read-only rt
cdatachannel property id returns an id number (between 0 and 65,534) which uniquely identifies the rt
cdatachannel.
... this id is set at the time the data channel is created, either by the user agent (if rt
cdatachannel.negotiated is false) or by the site or app script (if negotiated is true).
... example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); console.log("channel id: " + dc.id); specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.id' in that specification.
RTCDataChannel.maxRetransmits - Web APIs
the read-only rt
cdatachannel property maxretransmits returns the maximum number of times the browser should try to retransmit a message before giving up, as set when the data channel was created, or null, which indicates that there is no maximum.
... this can only be set when the rt
cdatachannel is created by calling rtcpeerconnection.createdatachannel(), using the maxretransmits field in the specified options.
... example // tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.maxretransmits' in that specification.
RTCDataChannel: message event - Web APIs
the webrtc message event is sent to the onmessage event handler on an rt
cdatachannel object when a message has been received from the remote peer.
... examples for a given rt
cdatachannel, dc, created for a peer connection using its createdatachannel() method, this code sets up a handler for incoming messages and acts on them by adding the data contained within the message to the current document as a new <p> (paragraph) element.
... you can also use an rt
cdatachannel object's onmessage event handler property to set the event handler: dc.onmessage = ev => { let newparagraph = document.createelement("p"); let textnode = document.createtextnode(event.data); newparagraph.appendchild(textnode); document.body.appendchild(newparagraph); } specifications specification status comment webrtc 1.0: real-time communication betwe...
RTCDataChannel.negotiated - Web APIs
the read-only rt
cdatachannel property negotiated indicates whether the rt
cdatachannel's connection was negotiated by the web app (true) or by the webrtc layer (false).
... syntax var negotiated = adatachannel.negotiated; value true if the rt
cdatachannel's connection was negotiated by the web app itself; false if the negotiation was handled by the webrtc layer.
... if (datachannel.negotiated) { shutdownremotechannel(datachannel.id); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.negotiated' in that specification.
RTCDataChannel.onclose - Web APIs
the rt
cdatachannel.onclose property is an eventhandler which specifies a function to be called by the browser when the close event is received by the rt
cdatachannel.
... syntax rt
cdatachannel.onclose = function; value a function which the browser will call to handle the close event.
...*/ specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.onclose' in that specification.
RTCDataChannel.onerror - Web APIs
the rt
cdatachannel.onerror property is an eventhandler which specifies a function to be called when the error event is received.
... syntax rt
cdatachannel.onerror = function; value a function which the browser will call to handle the error event when it occurs on the data channel.
...*/ specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.onerror' in that specification.
RTCDataChannel.onmessage - Web APIs
the rt
cdatachannel.onmessage property stores an eventhandler which specifies a function to be called when the message event is fired on the channel.
... syntax rt
cdatachannel.onmessage = function; value a function which the browser will call to handle the message event.
...t pc = new rtcpeerconnection(); let dc = pc.createdatachannel(); dc.onmessage = function(event) { var el = document.createelement("p"); var txtnode = document.createtextnode(event.data); el.appendchild(txtnode); receivebox.appendchild(el); } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.onmessage' in that specification.
RTCDataChannel.onopen - Web APIs
the rt
cdatachannel.onopen property is an eventhandler which specifies a function to be called when the open event is fired; this is a simple event which is sent when the data channel's underlying data transport—the link over which the rt
cdatachannel's messages flow—is established or re-established.
... syntax rt
cdatachannel.onopen = function; value a function which the browser will call to handle the open event.
...essage channel"); dc.onopen = function(event) { let messagebox = document.getelementbyid("messagebox"); let sendbutton = document.getelementbyid("sendbutton"); messagebox.disabled = false; messagebox.focus(); sendbutton.disabled = false; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.onopen' in that specification.
RTCDataChannel.ordered - Web APIs
the read-only rt
cdatachannel property ordered indicates whether or not the data channel guarantees in-order delivery of messages; the default is true, which indicates that the data channel is indeed ordered.
... this is set when the rt
cdatachannel is created, by setting the ordered property on the rt
cdatachannelinit object passed as rtcpeerconnection.createdatachannel()'s options parameter.
... example var pc = new rtcpeerconnection(); var dc = pc.createdatachannel("my channel"); if (!dc.ordered) { // handle unordered messaging } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.ordered' in that specification.
RTCDataChannel.reliable - Web APIs
the read-only rt
cdatachannel property reliable indicates whether or not the data channel is reliable.
...use rt
cdatachannel.ordered instead in any new code, and update existing code as soon as possible.
... syntax var reliable = adatachannel.reliable; value true if the rt
cdatachannel's connection is reliable; false if it isn't.
RTCDataChannel.stream - Web APIs
the deprecated (and never part of the official specification) read-only rt
cdatachannel property stream returns an id number (between 0 and 65,535) which uniquely identifies the rt
cdatachannel.
... this id is set at the time the data channel is created, either by the user agent (if rt
cdatachannel.negotiated is false) or by the site or app script (if negotiated is true).
... this property has been replaced with the rt
cdatachannel.id property.
RTCDataChannelEvent.channel - Web APIs
the read-only property rt
cdatachannelevent.channel returns the rt
cdatachannel associated with the event.
... syntax var channel = rt
cdatachannelevent.channel; value a rt
cdatachannel object representing the data channel linking the receiving rtcpeerconnection to its remote peer.
... pc.ondatachannel = function(event) { inbounddatachannel = event.channel; inbounddatachannel.onmessage = handleincomingmessage; inbounddatachannel.onopen = handlechannelopen; inbounddatachannel.onclose = handlechannelclose; } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannelevent.channel' in that specification.
RTCDataChannel.binaryType - Web APIs
the property binarytype on the rt
cdatachannel interface is a domstring which specifies the type of javascript object which should be used to represent binary data received on the rt
cdatachannel.
....createdatachannel("binary"); dc.binarytype = "arraybuffer"; dc.onmessage = function(event) { let bytearray = new uint8array(event.data); let hexstring = ""; bytearray.foreach(function(byte) { hexstring += byte.tostring(16) + " "; }); }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.binarytype' in that specification.
RTCDataChannel: error event - Web APIs
a webrtc error event is sent to an rt
cdatachannel object's onerror error handler when an error occurs on the data channel.
... you can also set up an event handler for error events using the rt
cdatachannel interface's onerror event handler property: dc.onerror = ev => { const err = ev.error; /* ...
RTCDataChannel.label - Web APIs
the read-only rt
cdatachannel property label returns a domstring containing a name describing the data channel.
...*/ document.getelementbyid("channel-name").innerhtml = "<span class='channelname'>" + dc.label + "</span>"; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.label' in that specification.
RTCDataChannel.maxPacketLifeTime - Web APIs
the read-only rt
cdatachannel property maxpacketlifetime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null.
... example // tbd specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.maxpacketlifetime' in that specification.
RTCDataChannel: open event - Web APIs
the webrtc open event is sent to an rt
cdatachannel object's onopen event handler when the underlying transport used to send and receive the data channel's messages is opened or re-opened.
... bubbles no cancelable no interface rt
cdatachannelevent event handler property onopen examples this example adds to the rt
cdatachannel dc a handler for the open event that adjusts the user interface to indicate that a chat window is ready to be used after a connection has been established.
RTCDataChannel.protocol - Web APIs
the read-only rt
cdatachannel property protocol returns a domstring containing the name of the subprotocol in use.
...l", { protocol: "json" }); function handlechannelmessage(datachannel, msg) { switch(datachannel.protocol) { case "json": /* process json data */ break; case "raw": /* process raw binary data */ break; } } specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rt
cdatachannel.protocol' in that specification.
Index - Web APIs
384
cdatasection api,
cdatasection, dom, interface, reference the
cdatasection interface represents a
cdata section that can be used within xml to include extended portions of unescaped text.
... the symbols < and & don’t need escaping as they normally do when inside a
cdata section.
... 703 domconfiguration api, dom, obsolete, reference pre-defined parameters: "canonical-form", "
cdata-sections", "check-character-normalization", "comments", "datatype-normalization", "element-content-whitespace", "entities", "error-handler", "infoset", "namespaces", "namespace-declarations", "normalize-characters","schema-location", "schema-type", "split-
cdata-sections", "validate", "validate-if-schema", "well-formed" 704 domerror api, dom, domerror, deprecated, interface, referen...
...And 36 more matches
Working with data
creating
cdata objects data types for use with js-ctypes are represented by ctype objects.
... these are javascript constructors; as such, they're callable functions that you can use to create new
cdata objects of that type.
... there are several ways you can go about creating new
cdata objects.
...And 15 more matches
JXON - Archive of obsolete content
gan.jpg">burgundy</color_swatch> </size> </catalog_item> <catalog_item gender="women's"> <item_number>rrx9856</item_number> <discount_until>dec 25, 1995</discount_until> <price>42.50</price> <size description="medium"> <color_swatch image="black_cardigan.jpg">black</color_swatch> </size> </catalog_item> </product> <script type="text/javascript"><![
cdata[function matchwo(a,b) { if (a < b && a < 0) { return 1; } else { return 0; } }]]></script> </catalog> first, create a dom tree like the previous example as described in the how to create a dom tree article.
... the algorithms proposed here (see: #1, #2, #3, #4) will consider only the following types of nodes and their attributes: document (only as function argument), documentfragment (only as function argument), element, text (never as function argument),
cdatasection (never as function argument), attr (never as function argument).
...onode.nodevalue.trim() : onode.nodevalue; } // nodetype is "text" (3) or "
cdatasection" (4) else if (onode.nodetype === 1 && !onode.prefix) { // nodetype is "element" (1) sprop = onode.nodename.tolowercase(); vcontent = new jxontree(onode); if (this.hasownproperty(sprop)) { if (this[sprop].constructor !== array) { this[sprop] = [this[sprop]]; } this[sprop].push(vcontent); } else { this[sprop] = vcontent; nlength++; } ...
...And 12 more matches
JNI.jsm
method overview
cdata getforthread();
cdata loadclass(
cdata ajenv, string aclassfullyqualifiedname, [optional] object adeclares);
cdata newstring(
cdata ajenv, string astr); string readstring(
cdata ajenv,
cdata ajavastring); void unloadclasses(); methods getforthread() blah blah
cdata getforthread(); parameters this function does not take any arguments.
... return value blah blah loadclass() blah blah
cdata loadclass( ajenv, afullyqualifiedname, [optional] object adeclares ); parameters ajenv the return value of getforthread().
... return value blah blah newstring() blah blah
cdata newstring( ajenv, astr ); parameters ajenv the return value of getforthread().
...And 11 more matches
Elements - Archive of obsolete content
1999/xhtml" xmlns:xul = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:svg = "http://www.w3.org/2000/svg" xmlns:xlink= "http://www.w3.org/1999/xlink"> binding <!entity % binding-content "(resources?,content?,implementation?,handlers?)"> <!element binding %binding-content;> <!attlist binding id id #required extends
cdata #implied display
cdata #implied inheritstyle true #implied > the binding element describes a single xbl binding.
... children <!element children empty> <!attlist children id id #implied includes
cdata #implied > specifies the location where any child elements of the bound element are placed in the generated content.
... implementation <!entity % implementation-content "(method|property)*"> <!element implementation %implementation-content;> <!attlist implementation id id #implied name
cdata #implied implements
cdata #implied > the implementation element describes the set of methods and properties that are attached to the bound element.
...And 9 more matches
Using WebRTC data channels - Web APIs
since all webrtc components are required to use encryption, any data transmitted on an rt
cdatachannel is automatically secured using datagram transport layer security (dtls).
... creating a data channel the underlying data transport used by the rt
cdatachannel can be created in one of two ways: let webrtc create the transport and announce it to the remote peer for you (by causing it to receive a datachannel event).
... automatic negotiation often, you can allow the peer connection to handle negotiating the rt
cdatachannel connection for you.
...And 9 more matches
WebRTC API - Web APIs
once a connection has been established and opened using rtcpeerconnection, media streams (mediastreams) and/or data channels (rt
cdatachannels) can be added to the connection.
... you can also use the connection between two peers to exchange arbitrary binary data using the rt
cdatachannel interface.
... rt
cdatachannel represents a bi-directional data channel between two peers of a connection.
...And 7 more matches
ArrayType
method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() arraytype
cdata syntax
cdata sized_arraytype();
cdata unsized_arraytype(length); sized_arraytype and unsized_arraytype are arraytype ctype.
... return value a
cdata representing the newly allocated array.
... arraytype
cdata properties property type description length number the length of the array.
...And 6 more matches
StructType
structtype
cdata syntax
cdata structtype(); structtype is structtype ctype.
... return value a
cdata representing the newly allocated struct.
... structtype
cdata properties every struct object has a getter and a setter for each member field of the structure.
...And 6 more matches
Example Sticky Notes - Archive of obsolete content
pacity="0.6" stroke="#ffffff" stroke-width="1px"> <svg:circle cx="25px" cy="12px" r="12" fill="#ff0000" transform="translate(0,0)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#00ff00" transform="translate(7,12)"/> <svg:circle cx="25px" cy="12px" r="12" fill="#0000ff" transform="translate(-7,12)"/> </svg:g> </svg:svg> <children/> </content> <implementation> <!-- here and futher
cdata wrappers around javascript code are not mandatory but recommended.
... it also speeds up the parsing as the engine doesn't go through
cdata sections but simply skip on them.
... --> <constructor><![
cdata[ /** * the code below will be called one time only after * the binding is successfully prepared and bound.
...And 5 more matches
Writing JavaScript for XHTML - Archive of obsolete content
the code looks something like this: <script type="text/javascript"> //<!-- window.alert("hello world!"); //--> </script> solution: the
cdata trick this problem usually arises, when inline scripts are included in comments.
...if your code contains either of these, you can work around this with
cdata sections: <script type="text/javascript"> <![
cdata[ // is the variable a non-negative integer less than 10?
... if (variable < 10 && variable >= 0) action(); ]]> </script> note that the
cdata section is only necessary because of the < in the code; otherwise you could have ignored it.
...And 4 more matches
PointerType
method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() pointertype
cdata syntax
cdata pointertype(); pointertype is pointertype ctype.
... return value a
cdata representing the newly allocated pointer.
... pointertype
cdata properties property type description contents
cdata reading this property returns a
cdata object referring to the pointed-to contents of the object.
...And 4 more matches
RTCPeerConnection.createDataChannel() - Web APIs
options optional an rt
cdatachannelinit dictionary providing configuration options for the data channel rt
cdatachannelinit dictionary the rt
cdatachannelinit dictionary provides the following fields, any of which may be included in the object passed as the options parameter in order to configure the data channel to suit your needs: ordered optional indicates whether or not messages sent on the rt
cdatachannel are requir...
... protocol optional the name of the sub-protocol being used on the rt
cdatachannel, if any; otherwise, the empty string ("").
... negotiated optional by default (false), data channels are negotiated in-band, where one side calls createdatachannel, and the other side listens to the rt
cdatachannelevent event using the ondatachannel eventhandler .
...And 4 more matches
ctypes
method overview ctype arraytype(type[, length]);
cdata cast(data, type); ctype functiontype(abi, returntype[, argtype1, ...]);
cdata int64(n); string libraryname(name); library open(libspec); ctype pointertype(typespec); ctype structtype(name[, fields]);
cdata uint64(n); properties property type description errno number the value of the latest system error.
...instead, they convert to objects of the wrapper types ctypes.int64 and ctypes.uint64, which are javascript objects rather than
cdata objects.
... for example, ctypes.char.array(30)(str) converts the string str to utf-8 and returns a new
cdata object of array type.
...And 3 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
in particular: raw < and & characters are not allowed except inside of
cdata sections (<![
cdata[ ...
... javascript contains characters which can not exist in xhtml javascript typically contains characters which can not exist in xhtml outside of
cdata sections.
... <script type="text/javascript"> <!-- var i; var sum = 0; for (i = 10; i > 0; --i) { sum += i; } // --> </script> using
cdata instead of comments properly enclosing script contents inside of
cdata sections can cause problems in downlevel browsers which do not understand xml.
...And 2 more matches
Custom XUL Elements with XBL - Archive of obsolete content
javascript code is enclosed in
cdata sections to prevent js and xml syntax conflicts.
...we use the shorthand version of the property tag: <property name="name" onget="return this.getattribute('name');" onset="this.setattribute('name', val);" /> there's a less compact version of the property tag that should be used if the getter or setter code involves more than one line of code: <property name="name"> <getter><![
cdata[ return this.getattribute('name'); ]]></getter> <setter><![
cdata[ this.setattribute('name', val); ]]></setter> </property> properties can be accessed just the same as fields, and they're the ones we prefer for public members.
... methods our "person" binding has a single method that removes the item from the list: <method name="remove"> <parameter name="aevent" /> <body><![
cdata[ this.parentnode.removechild(this); ]]></body> </method> as you can see, it's very easy to define a method and the parameters it takes.
...we have a "click" handler that displays the greeting when the "person" element is clicked: <handler phase="bubbling" event="click"><![
cdata[ window.alert(this.greeting); ]]></handler> handlers are not necessary all that often, since in most cases you'll need the events to only apply to a part of the binding, not the whole thing.
Browser Feature Detection - Archive of obsolete content
ue true true document.implementation true true true document.documentelement true true true document.createelement() true true true document.createdocumentfragment() true true true document.createtextnode() true true true document.createcomment() true true true document.create
cdatasection() true false true document.createprocessinginstruction() true false true document.createattribute() true true true document.createentityreference()obsolete since gecko 7 (method present but only returns null: bug 9850) false false document.getelementsbytagname() true true true dom core level 2 support ...
...ue true true document.implementation true true true document.documentelement true true true document.createelement() true true true document.createdocumentfragment() true true true document.createtextnode() true true true document.createcomment() true true true document.create
cdatasection() true false true document.createprocessinginstruction() true false true document.createattribute() true true true document.createentityreference()obsolete since gecko 7 true false false document.getelementsbytagname() true true true document.importnode() true false true document.cre...
...support levels var _features = { 'domcore1': [ {name: 'doctype', 'supported': false}, {name: 'implementation', 'supported': false}, {name: 'documentelement', 'supported': false}, {name: 'createelement', 'supported': false}, {name: 'createdocumentfragment', 'supported': false}, {name: 'createtextnode', 'supported': false}, {name: 'createcomment', 'supported': false}, {name: 'create
cdatasection', 'supported': false}, {name: 'createprocessinginstruction', 'supported': false}, {name: 'createattribute', 'supported': false}, {name: 'createentityreference', 'supported': false}, {name: 'getelementsbytagname', 'supported': false} ], 'domhtml': [ {name: 'documentelement', 'supported': false}, {name: 'createelement', 'supported': false}, {name: 'createdocumentfragment',...
...yname', 'supported': false} ], 'domcore2': [ {name: 'doctype', 'supported': false}, {name: 'implementation', 'supported': false}, {name: 'documentelement', 'supported': false}, {name: 'createelement', 'supported': false}, {name: 'createdocumentfragment', 'supported': false}, {name: 'createtextnode', 'supported': false}, {name: 'createcomment', 'supported': false}, {name: 'create
cdatasection', 'supported': false}, {name: 'createprocessinginstruction', 'supported': false}, {name: 'createattribute', 'supported': false}, {name: 'createentityreference', 'supported': false}, {name: 'getelementsbytagname', 'supported': false}, {name: 'importnode', 'supported': false}, {name: 'createelementns', 'supported': false}, {name: 'createattributens', 'supported': false}, {na...
FunctionType
method overview methods inherited from ctype ctype array([n]) string tosource() string tostring() functiontype
cdata functiontype
cdata cannot be constructed.
...
cdata functiontype.ptr([func]); functiontype is functiontype ctype.
... return value a
cdata representing the newly allocated function pointer.
... see also ctype
cdata abi library type conversion ...
js-ctypes reference
cdata objects.
... data these are instances of types, represented by
cdata objects and instantiated by calling ctype objects as functions.
...calling a ctype will return a
cdata.
...you call a native function with
cdata objects.
RTCPeerConnection.ondatachannel - Web APIs
this event, of type rt
cdatachannelevent, is sent when an rt
cdatachannel is added to the connection by the remote peer calling createdatachannel().
... at the time this event is received, the rt
cdatachannel it indicates may not yet actually be open.
... be sure to wait for the "open" event to be fired on the new rt
cdatachannel before using it.
... syntax rtcpeerconnection.ondatachannel = function; value set this property to be a function you provide which receives as input a single parameter: an rt
cdatachannelevent which provides in its channel property the rt
cdatachannel which has been created.
XBL Example - Archive of obsolete content
<method name="setpage"> <parameter name="newidx"/> <body> <![
cdata[ var thedeck=document.getanonymousnodes(this)[0].childnodes[0]; var totalpages=this.childnodes.length; if (newidx<0) return 0; if (newidx>=totalpages) return totalpages; thedeck.setattribute("selectedindex",newidx); document.getanonymousnodes(this)[0].childnodes[1].childnodes[1] .setattribute("value",(newidx+1)+" of "+totalpages); return ne...
...the body of the method has been enclosed inside <![
cdata[ and ]]>.
...his)[0].childnodes[1].childnodes[1] .setattribute("value",(this.page+1)+" of "+totalpages); </constructor> <property name="page" onget="return parseint(document.getanonymousnodes(this)[0].childnodes[0].getattribute('selectedindex'));" onset="return this.setpage(val);"/> <method name="setpage"> <parameter name="newidx"/> <body> <![
cdata[ var thedeck=document.getanonymousnodes(this)[0].childnodes[0]; var totalpages=this.childnodes.length; if (newidx<0) return 0; if (newidx>=totalpages) return totalpages; thedeck.setattribute("selectedindex",newidx); document.getanonymousnodes(this)[0].childnodes[1].childnodes[1] .setattribute("value",(newidx+1)+" of "+...
Fun With XBL and XPConnect
<binding name="autocomplete" extends="xul:box"> <content> <xul:textfield class="addressingwidget"/> <xul:menupopup/> </content> <implementation> <property name="autocompletesession"> <![
cdata[ components.classes['component://netscape/messenger/autocomplete&type=addrbook'].
... <method name="autocomplete"> <argument name="asearchstring"/> <argument name="resultlistener"/> <body> <![
cdata[ return this.autocompletesession.autocomplete(null, anonymouscontent[0], asearchstring, this.autocompletelistener); ]]> </body> </method> you can see that the body of the method is just getting the auto complete session object and calling the auto complete method on it.
...i could apply a trick similar to what i did for the xpcom object: <property name="autocompletelistener"> <![
cdata[ ({ onautocompleteresult: function(aitem, aoriginalstring, amatch) { if ( aitem ) { anonymouscontent[0].value = amatch; } } }) ]]> </property> as long as the js for the value of autocompletelistener evaluates to an object (and wrapping the expression with a set of parens like i did, does this), then the value of autocomp...
Memory Management
a
cdata will hold referent
cdata objects alive, under specific circumstances.
... for example, a
cdata object produced by accessing a field of a structure or the internals of an array will hold the referent objects alive.
... what won't keep objects alive it's important to note that getting direct access to the contents of a
cdata object using address(), addressofelement(), or contents, will result in a
cdata object that does not hold its referent alive.
Library
method overview close();
cdata declare(name, [abi, ], returntype[, argtype1, ...]); methods close() closes the library.
...
cdata declare( name[, abi, returntype argtype1, ...] ); parameters name the name of the symbol exported by the native library that is to be declared as usable from javascript abi the abi used by the exported function; this will be ctypes.default_abi for most libraries, except for windows libraries, which will be ctypes.winapi_abi or ctypes.stdcall_abi.
... return value a functiontype
cdata object representing the declared api.
RTCPeerConnection: datachannel event - Web APIs
a datachannel event is sent to an rtcpeerconnection instance when an rt
cdatachannel has been added to the connection, as a result of the remote peer calling rtcpeerconnection.createdatachannel().
... bubbles no cancelable no interface rt
cdatachannelevent event handler property ondatachannel examples this example sets up a function that handles datachannel events by gathering the information needed to communicate with the newly added rt
cdatachannel and by adding event handlers for the events that occur on that channel.
... pc.addeventlistener("datachannel", ev => { receivechannel = ev.channel; receivechannel.onmessage = myhandlemessage; receivechannel.onopen = myhandleopen; receivechannel.onclose = myhandleclose; }, false); receivechannel is set to the value of the event's channel property, which specifies the rt
cdatachannel object representing the data channel linking the remote peer to the local one.
Example - SVG: Scalable Vector Graphics
view the example <?xml version='1.0'?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <head> <title>a swarm of motes</title> <style type='text/css'> <![
cdata[ label, input { width: 150px; display: block; float: left; margin-bottom: 10px; } label { text-align: right; width: 75px; padding-right: 20px; } br { clear: left; } ]]> </style> </head> <body onload='update()'> <svg:svg id='display' width='400' height='300'> <svg:circle id='cursor' cx='200' cy='150' r='7' fill='#0000ff' fill-opacity='0.5'/> </s...
... </p> <div> (c) 2006 <a id='emailme' href='#'>nick johnson</a> <script type='text/javascript'> <![
cdata[ // foil spam bots var email = '@riovia.net'; email ='nick' + email; document.getelementbyid('emailme').href = 'mailto:'+email; ]]> </script> this software is free for you to use in any way whatsoever, and comes with no warranty at all.
...velocity:</label> <input id='max_velocity' value='15'/> <br/> <label>attraction to cursor:</label> <input id='attract_cursor' value='6'/> <br/> <label>repulsion from peers:</label> <input id='repel_peer' value='5'/> <br/> </p> </form> <script type='text/javascript'> <![
cdata[ // array of motes var motes; // get the display element.
QuerySelector - Archive of obsolete content
.queryselector(selector); }; example: <h1>test!</h1> <script> htmldocument.prototype.$ = function (selector) { return this.queryselector(selector); }; alert(document.$('h1')); // [object htmlheadingelement] </script> xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; example: <label value="test!"/> <script type="text/javascript"><![
cdata[ xuldocument.prototype.$ = function (selector) { // only for xul return this.queryselector(selector); }; alert(document.$('label')); // [object xulelement] ]]></script> document.prototype.$ = function (selector) { // only for plain xml return this.queryselector(selector); }; var foo = document.implementation.createdocument('somens', 'foo', null); // create an xml document <foo xmlns="so...
... element.prototype.$ = function (selector) { // works for html, xul, and plain xml return this.queryselector(selector); }; html example: <h1><a>test!<a/></h1> <script> element.prototype.$ = function (selector) { return this.queryselector(selector); }; alert(document.getelementsbytagname('h1')[0].$('a').nodename); // 'a' xul example: <hbox><vbox/></hbox> <script type="text/javascript"><![
cdata[ element.prototype.$ = function (selector) { return this.queryselector(selector); }; var xulns = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'; alert(document.getelementsbytagnamens(xulns, 'hbox')[0].$('vbox').nodename); // vbox ]]></script> xml example: <foo xmlns="somens"><bar/></foo> in document earlier var foo = document.getelementsbytagnamens('somens', 'foo')[0]; alert...
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
if you are embedding a script in a page, you should bracket your code inside a
cdata section as shown in listing 18; this will avoid errors caused by mistakenly reading "&" and other characters as the beginnings of entity references.
... <script type="application/javascript"><![
cdata[ var nodes = gbrowser.mtabcontainer.childnodes; for (var i = 0; i < nodes.length; i++) alert(nodes[i].label); ]]></script> listing 18: embedding a script in xul note: although embedding javascript is permitted, it's generally encouraged that you instead place your javascript code in an external file.
Creating reusable content with CSS and XBL - Archive of obsolete content
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml"> <binding id="square"> <resources> <stylesheet src="bind6.css"/> </resources> <content> <html:div anonid="square"/> <xul:button anonid="button" type="button"> <children/> </xul:button> </content> <implementation> <field name="square"><![
cdata[ document.getanonymouselementbyattribute(this, "anonid", "square") ]]></field> <field name="button"><![
cdata[ document.getanonymouselementbyattribute(this, "anonid", "button") ]]></field> <method name="dodemo"> <body><![
cdata[ this.square.style.backgroundcolor = "#cf4" this.square.style.marginleft = "20em" this.button.setattribute("d...
...isabled", "true") settimeout(this.cleardemo, 2000, this) ]]></body> </method> <method name="cleardemo"> <parameter name="me"/> <body><![
cdata[ me.square.style.backgroundcolor = "transparent" me.square.style.marginleft = "0" me.button.removeattribute("disabled") ]]></body> </method> </implementation> <handlers> <handler event="click" button="0"><![
cdata[ if (event.originaltarget == this.button) this.dodemo() ]]></handler> </handlers> </binding> </bindings> make a new css file, bind6.css.
Processing XML with E4X - Archive of obsolete content
for backwards compatibility, e4x defaults to ignoring comments and
cdata sections.
...since a greater than sign is not escaped, it is possible to get an xml error if the
cdata closing sequence (]]>) is included.
SVG Guidelines
avoid the use of
cdata sections
cdata sections are used to avoid parsing some text as html.
... most of time,
cdata isn't needed, for example, the content in <style> tags doesn't need to be wrapped in a
cdata section as the content inside the tag is already correctly parsed as css.
Parser API
interface xml
cdata <: xml { type: "xml
cdata"; contents: string; } an xml
cdata node.
... xml
cdata(contents[, loc]) contents: string loc: sourcelocation returns: customxml callback to produce a custom xml
cdata node.
Places Developer Guide
getservice(components.interfaces.nspiplacesdatabase).dbconnection; } and then to get the a redirected visit_id from another visit_id: function getfromvisit(visit_id) { var sql = <
cdata><![
cdata[ select from_visit from moz_places, moz_historyvisits where moz_historyvisits.id = :visit_id and moz_places.id = moz_historyvisits.place_id; ]]></
cdata>.tostring(); var sql_stmt = getplacesdbconn.createstatement(sql); sql_stmt.params.visit_id = visit_id; var from_visit; try { // here we can't use the "executeasync" method since have to return a // result righ...
... while (sql_stmt.executestep()) { from_visit = sql_stmt.row.from_visit; } } finally { sql_stmt.reset(); } return from_visit; } note: the <
cdata><![
cdata[ xxx ]]></
cdata>.tostring() notation is e4x and it makes possible to write multi-line strings in javascript.
XPIDL Syntax
pyxpidl syntax idlfile = *(
cdata / include / interface / typedef / native) typedef = "typedef" identifer identifier ";" native = [attributes] "native" identifier "(" nativeid ")" interface = [attributes] "interface" identifier" [ifacebase] [ifacebody] ";" ifacebase = ":" identifier ifacebody = "{" *(member) "}" member =
cdata / "const" identifier identifier "=" number ";" member /= [attributes] ["readonly"] "attribute...
...tifier / const) ["(" (identifier / iid) ")"] param = [attributes] ("in" / "out" / "inout") identifier identifier number = number / identifier number /= "(" number ")" number /= "-" number number /= number ("+" / "-" / "*") number number /= number ("<<" / >>") number number /= number "|" number ; lexical tokens, i'm going to specify these in regex form number = /-?\d+|0x[0-9a-fa-f]+/
cdata = /%{[ ]*c\+\+[ ]*\n(.*?\n?)%}[ ]*(c\+\+)?/s include = /\#include[ \t]+"[^"\n]+"/ nativeid = /[^()\n]+(?=\))/ iid = /[0-9a-fa-f]{8}-[0-9a-fa-f]{4}-[0-9a-fa-f]{4}-[0-9a-fa-f]{12}/ identifier = /unsigned long long|unsigned short|unsigned long|long long|[a-za-z][a-za-z_0-9]*/ ...
Using Objective-C from js-ctypes
we need to declare three different functiontype
cdatas: returns id or compatible type.
... let objc_getclass = lib.declare("objc_getclass", ctypes.default_abi, id, ctypes.char.ptr); let sel_registername = lib.declare("sel_registername", ctypes.default_abi, sel, ctypes.char.ptr); calling variadic function objc_msgsend is a variadic function, so we should always pass it a
cdata instance, other than this first and second argument, to declare each argument type.
Debugging Tips
printing
cdata and ctype currently console.log doesn't show type information of
cdata.
... let { ctypes } = components.utils.import("resource://gre/modules/ctypes.jsm", {}); let i = ctypes.int32_t(10); console.log(i); let point = ctypes.structtype("point", [{ x: ctypes.int32_t }, { y: ctypes.int32_t }]) let p = point(10, 20); console.log(p); let pp = p.address(); console.log(pp); the result will be as following:
cdata { value: 10 }
cdata { x: 10, y: 20 }
cdata { contents:
cdata } to see more descriptive information, you can use .tosource().
Declaring and Using Callbacks
in the ordinary case, invoking the type object creates a regular
cdata object containing a pointer to the data.
...for arguments of complex types, temporary
cdata objects will be created.
Node.nodeValue - Web APIs
for text, comment, and
cdata nodes, nodevalue returns the content of the node.
... the following table shows the return values for different elements: node value of nodevalue
cdatasection content of the
cdata section comment content of the comment document null documentfragment null documenttype null element null namednodemap null entityreference null notation null processinginstruction entire content excluding the target text content of the text node when nodevalue is defined to be null, setting it has no effect.
Node.textContent - Web APIs
note: to get all of the text and
cdata data for the whole document, one could use document.documentelement.textcontent.
... if the node is a
cdata section, comment, processing instruction, or text node, textcontent returns the text inside the node, i.e., the node.nodevalue.
Node - Web APIs
these include attr, characterdata (which text, comment, and
cdatasection are all based on), processinginstruction, documenttype, notation, entity, and entityreference.
...possible values are: name value element_node 1 attribute_node 2 text_node 3
cdata_section_node 4 entity_reference_node 5 entity_node 6 processing_instruction_node 7 comment_node 8 document_node 9 document_type_node 10 document_fragment_node 11 notation_node 12 node.nodevalue returns / sets the value of the current node.
RTCDtlsTransport - Web APIs
when not using bundle when the connection is created without using bundle, each rtp or rtcp component of each rtcrtptransceiver has its own rtcdtlstransport; that is, every rtcrtpsender and rtcrtpreceiver, has its own transport, and all rt
cdatachannel objects share a transport dedicated to sctp.
... data channels rt
cdatachannels use sctp to communicate.
RTCError - Web APIs
examples in this example, a handler is established for an rt
cdatachannel's error event.
...you can also use the rt
cdatachannel object's onerror event handler property, like this: datachannel.onerror = (event) => { let error = event.error; /* and so forth */ }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcerror' in that specification.
RTCErrorEvent.error - Web APIs
examples in this example, a handler is established for an rt
cdatachannel's error event.
...you can also use the rt
cdatachannel object's onerror event handler property, like this: datachannel.onerror = (event) => { let error = event.error; /* and so forth */ }; specifications specification status comment webrtc 1.0: real-time communication between browsersthe definition of 'rtcerrorevent.error' in that specification.
RTCPeerConnection - Web APIs
this event, of type rt
cdatachannelevent, is sent when an rt
cdatachannel is added to the connection by the remote peer calling createdatachannel().onicecandidatethe rtcpeerconnection property onicecandidate property is an eventhandler which specifies a function to be called when the icecandidate event occurs on an rtcpeerconnection instance.
... datachannel sent to the rtcpeerconnection object when the remote peer adds an rt
cdatachannel to the connection.
RTCSctpTransport - Web APIs
properties also inherits properties from: eventtarget rtcsctptransport.maxchannelsread only an integer value indicating the maximum number of rt
cdatachannels that can be open simultaneously.
... rtcsctptransport.maxmessagesizeread only an integer value indicating the maximum size, in bytes, of a message which can be sent using the rt
cdatachannel.send() method.
WebGL2RenderingContext.compressedTexSubImage3D() - Web APIs
syntax // read from the buffer bound to gl.pixel_unpack_buffer void gl.compressedtexsubimage3d(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imagesize, offset); void gl.compressedtexsubimage3d(target, level, xoffset, yoffset, zoffset, width, height, depth, format, arraybufferview sr
cdata, optional srcoffset, optional srclengthoverride); parameters target a glenum specifying the binding point (target) of the active texture.
... sr
cdata an arraybufferview that be used as a data store for the compressed image data in memory.
WebGLRenderingContext.bufferData() - Web APIs
sr
cdata, usage); void gl.bufferdata(target, arraybufferview sr
cdata, usage); // webgl2: void gl.bufferdata(target, arraybufferview sr
cdata, usage, srcoffset, length); parameters target a glenum specifying the binding point (target).
... sr
cdata optional an arraybuffer, sharedarraybuffer or one of the arraybufferview typed array types that will be copied into the data store.
WebGLRenderingContext.bufferSubData() - Web APIs
syntax // webgl1: void gl.buffersubdata(target, offset, arraybuffer sr
cdata); void gl.buffersubdata(target, offset, arraybufferview sr
cdata); // webgl2: void gl.buffersubdata(target, dstbyteoffset, arraybufferview sr
cdata, srcoffset, length); parameters target a glenum specifying the binding point (target).
... sr
cdata optional an arraybuffer, sharedarraybuffer or one of the arraybufferview typed array types that will be copied into the data store.
WebRTC Statistics API - Web APIs
rtcrtpcontributingsourcestats rtcstats data-channel statistics related to one rt
cdatachannel on the connection.
... rt
cdatachannelstats rtcstats ice-server statistics about the connection to an ice server (stun or turn.
Web APIs
tevent beforeunloadevent biquadfilternode blob blobbuilder blobevent bluetooth bluetoothadvertisingdata bluetoothcharacteristicproperties bluetoothdevice bluetoothremotegattcharacteristic bluetoothremotegattdescriptor bluetoothremotegattserver bluetoothremotegattservice body broadcastchannel budgetservice budgetstate buffersource bytelengthqueuingstrategy bytestring c
cdatasection css cssconditionrule csscounterstylerule cssgroupingrule cssimagevalue csskeyframerule csskeyframesrule csskeywordvalue cssmathproduct cssmathsum cssmathvalue cssmediarule cssnamespacerule cssnumericvalue cssomstring csspagerule csspositionvalue cssprimitivevalue csspseudoelement cssrule cssrulelist cssstyledeclaration cssstylerule cssstylesheet cssstylevalue csssup...
... plugin pluginarray point pointerevent popstateevent positionoptions processinginstruction progressevent promiserejectionevent publickeycredential publickeycredentialcreationoptions publickeycredentialrequestoptions pushevent pushmanager pushmessagedata pushregistrationmanager pushsubscription r rtcansweroptions rtccertificate rtcconfiguration rtcdtmfsender rtcdtmftonechangeevent rt
cdatachannel rt
cdatachannelevent rtcdtlstransport rtcerror rtcerrorevent rtcicecandidate rtcicecandidateinit rtcicecandidatepair rtcicecandidatepairstats rtcicecandidatestats rtcicecandidatetype rtcicecomponent rtcicecredentialtype rtcicegathererstate rtciceparameters rtciceprotocol rtcicerole rtciceserver rtcicetcpcandidatetype rtcicetransport rtcicetransportstate rtcidentityassertion rtcide...
Texts - SVG: Scalable Vector Graphics
<text> this is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> playable code <svg width="350" height="60" xmlns="http://www.w3.org/2000/svg"> <text> this is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> <style><![
cdata[ text{ dominant-baseline: hanging; font: 28px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> the tspan element has the following custom attributes: x set a new absolute x coordinate for the containing text.
... </textpath> </text> <style><![
cdata[ text{ dominant-baseline: hanging; font: 28px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> « previousnext » ...
<xsl:output> - XSLT: Extensible Stylesheet Language Transformations
syntax <xsl:output method="xml" | "html" | "text" version=string encoding=string omit-xml-declaration="yes" | "no" standalone="yes" | "no" doctype-public=string doctype-system=string
cdata-section-elements=list-of-names indent="yes" | "no" media-type=string /> required attributes none.
...
cdata-section-elements lists elements whose text contents should be written as
cdata sections.
LookupNamespaceURI - Archive of obsolete content
case 10: // document_type_node case 11: // document_fragment_node return null; // unknown case 2: // attribute_node if (node.ownerelement) { return lookupnamespaceurihelper(node.ownerelement, prefix); } return null; // unknown default: // text_node (3),
cdata_section_node (4), entity_reference_node (5), // processing_instruction_node (7), comment_node (8) if (node.parentnode) { // entityreferences may have to be skipped to get to it return lookupnamespaceurihelper(node.parentnode, prefix); } return null; // unknown } }; } }()); ...
Interaction between privileged and non-privileged pages - Archive of obsolete content
terface(components.interfaces.nsidocshelltreeitem) .roottreeitem .queryinterface(components.interfaces.nsiinterfacerequestor) .getinterface(components.interfaces.nsidomwindow); mainwindow.document.addeventlistener("myextensionevent", function(e) { myextension.mylistener(e); }, false, true); if you need to to pass lots of data, consider using
cdata sections instead of the simple attributes on a custom element.
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
listing 1: calling xpcom functions using xpconnect <?xml version="1.0" encoding="utf-8"?> <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript"><![
cdata[ var ioservice = components.classes['@mozilla.org/network/io-service;1'] .getservice(components.interfaces.nsiioservice); alert(ioservice); ]]></script> </page> calling xpconnect using local files try saving the contents of listing 1 as the file test.xul, somewhere on your desktop, and drag and drop it into firefox to open it.
Jetpack Snippets - Archive of obsolete content
using firebug lite in a slidebar jetpack.future.import("slidebar");jetpack.slidebar.append({ html: <html><head></head><body> <p>some slidbar you want to debug</p> <a href="javascript:console.log('hello!')">test</a> <script><![
cdata[ //firebug lite bookmarklet code: var firebug=document.createelement('script'); firebug.setattribute('src','http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'); document.body.appendchild(firebug); (function(){if(window.firebug.version){firebug.init();}else{settimeout(arguments.callee);}})();void(firebug); ...
Introduction to XUL - Archive of obsolete content
javascript is most safely kept in a separate file and included in the xul file <html:script language="javascript" src="our.js"/> or relegated to the contents of a
cdata section, to prevent the xml parser from choking on javascript which may look like xml content (a < character, for instance.) <html:script type="application/javascript"> <![
cdata[ function lesser(a,b) { return a < b ?
Node - Archive of obsolete content
for more information on this interface please see dom-level-2-core short element_node 1 short attribute_node 2 short text_node 3 short
cdata_section_node 4 short entity_reference_node 5 short entity_node 6 short processing_instruction_node 7 short comment_node 8 short document_node 9 short document_type_node 10 short document_fragment_node 11 short notation_node 12 methods node appendchild ( node newchild ) node clonenode ( boolean deep ) boolean hasattributes ( ) boolean haschildnodes ( ) node insertbefore ( node newchild , n...
Tree View Details - Archive of obsolete content
nd of the complete example, shown here: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window onload="init();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <tree id="elementlist" flex="1"> <treecols> <treecol id="element" label="element" primary="true" flex="1"/> </treecols> <treechildren/> </tree> <script> <![
cdata[ var treeview = { childdata : { solids: ["silver", "gold", "lead"], liquids: ["mercury"], gases: ["helium", "nitrogen"] }, visibledata : [ ["solids", true, false], ["liquids", true, false], ["gases", true, false] ], treebox: null, selection: null, get rowcount() { return this.visibledata.length; }, settree: function(treebox) ...
MacFAQ - Archive of obsolete content
]) <?xml version="1.0"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="myxul_hidden" windowtype="myxul:hiddenwindow" title="" width="0" height="0" persist="screenx screeny width height sizemode" > <!-- load the mozilla helpers --> <script type="application/javascript" src="chrome://global/content/nsusersettings.js" /> <script><![
cdata[ function debug(alogstring) { var mconsoleservice = components.classes["@mozilla.org/consoleservice;1"] .getservice(components.interfaces.nsiconsoleservice) mconsoleservice.logstringmessage("myxul: " + alogstring + "\n"); } function checkotherwindows() { var singletonwindowtype = nspreferences.copyunicharpref("toolkit.singletonwindowty...
E4X - Archive of obsolete content
the difference between the two modes is that without the "e4x=1" mime type, any statement-level xml/html comment literals (<!--...-->) are ignored for backwards compatibility with the comment hiding trick, and
cdata sections (<![
cdata[...]]>) are not parsed as
cdata literals (which leads to a js syntax error in html since html's <script> element produces an implicit
cdata section, and therefore cannot contain explicit
cdata sections).
nsIDOMNode
constants constant value description element_node 1 attribute_node 2 text_node 3
cdata_section_node 4 entity_reference_node 5 entity_node 6 processing_instruction_node 7 comment_node 8 document_node 9 document_type_node 10 document_fragment_node 11 notation_node 12 methods appendchild() nsidomnode appendchild( in nsidomnode newchild ); parameters newchild return value clonenode() nsidomnode clonenode( in boolean deep ); parameters dee...
Working with windows in chrome code
opendialog("chrome://test/content/progress.xul", "myprogress", "chrome,centerscreen", {status: "reading remote data", maxprogress: 50, progress: 10} ); progress.xul: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window onload="onload();" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script><![
cdata[ var gstatus, gprogressmeter; var maxprogress = 100; function onload() { gstatus = document.getelementbyid("status"); gprogressmeter = document.getelementbyid("progressmeter"); if("arguments" in window && window.arguments.length > 0) { maxprogress = window.arguments[0].maxprogress; setprogress(window.arguments[0].progress); setstatus(window.arguments[0].status); } } functi...
Declaring types
var timestr = asctime(thetime.address()); // pass a pointer to the tm struct var jsstring = timestr.readstring(); // convert the c string to javascript the last line converts the c string returned by the libc asctime() function into a javascript string by calling the
cdata readstring() method.
Type conversion
x: 10, z: 10 }; // throws error target type source converted value any struct types js object (only if the object has properties for all fields and no other properties) implicitly convert each enumerable property to corresponding field explicit convert in js-ctypes, data could be converted explicitly, when passing to
cdata constructor: ctypes.int32_t("123"); // string "123" is parsed as 10-base string explicit convert tries implicit convert first, and if it fails, the following rules are applied: boolean type target type source converted value ctype.bool js value toboolean(src) console.log(ctypes.bool("123").tostring()); // 'ctypes.bool(true)' console.log(ctypes.bool("").to...
Working with ArrayBuffers
pixelbuffer.tostring(); // "ctypes.uint8_t.ptr(ctypes.uint64("0x352e0000"))" var imgwidth = 400; var imgheight = 400; var myimgdat = new imagedata(imgwidth, imgheight); method 1: passing arraytype
cdata to uint8clampedarray.prototype.set one method is to get into a js-ctypes array, and then set it into the imagedata, as illustrated by the following code example.
js-ctypes
abi
cdata ctype ctypes functiontype int64 library uint64 view all...
DOMConfiguration - Web APIs
pre-defined parameters: "canonical-form", "
cdata-sections", "check-character-normalization", "comments", "datatype-normalization", "element-content-whitespace", "entities", "error-handler", "infoset", "namespaces", "namespace-declarations", "normalize-characters","schema-location", "schema-type", "split-
cdata-sections", "validate", "validate-if-schema", "well-formed" properties domconfiguration.parameternames read only is a domstringlist methods domconfiguration.cansetparameter() returns a boolean domconfiguration.getparameter() returns a domuserdata domconfiguration.setparameter() sets a parameter specification http://www.w3.org/tr/dom-level-3-cor...mconfiguration ...
Document.createElementNS() - Web APIs
hough this is not an extremely useful xul document, it does demonstrate the use of elements from two different namespaces within a single document: <?xml version="1.0"?> <page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml" title="||working with elements||" onload="init()"> <script type="application/javascript"><![
cdata[ let container; let newdiv; let txtnode; function init(){ container = document.getelementbyid("containerbox"); newdiv = document.createelementns("http://www.w3.org/1999/xhtml", "div"); txtnode = document.createtextnode("this is text that was constructed dynamically with createelementns and createtextnode then inserted into the document using appendchild."); newdiv.appendchild(txt...
Document Object Model (DOM) - Web APIs
dom interfaces attr
cdatasection characterdata childnode comment customevent document documentfragment documenttype domerror domexception domimplementation domstring domtimestamp domstringlist domtokenlist element event eventtarget htmlcollection mutationobserver mutationrecord namednodemap node nodefilter nodeiterator nodelist nondocumenttypechildnode parentnode processinginstruction sele...
Element: DOMActivate event - Web APIs
yes interface mouseevent examples <svg xmlns="http://www.w3.org/2000/svg" version="1.2" baseprofile="tiny" xmlns:ev="http://www.w3.org/2001/xml-events" width="6cm" height="5cm" viewbox="0 0 600 500"> <desc>example: invoke an ecmascript function from a domactivate event</desc> <!-- ecmascript to change the radius --> <script type="application/ecmascript"><![
cdata[ function change(evt) { var circle = evt.target; var currentradius = circle.getfloattrait("r"); if (currentradius == 100) circle.setfloattrait("r", currentradius * 2); else circle.setfloattrait("r", currentradius * 0.5); } ]]></script> <!-- act on each domactivate event --> <circle cx="300" cy="225" r="100" fill="red"> <handler type="appl...
Element.localName - Web APIs
example (must be served with xml content type, such as text/xml or application/xhtml+xml.) <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <head> <script type="application/javascript"><![
cdata[ function test() { var text = document.getelementbyid('text'); var circle = document.getelementbyid('circle'); text.value = "<svg:circle> has:\n" + "localname = '" + circle.localname + "'\n" + "namespaceuri = '" + circle.namespaceuri + "'"; } ]]></script> </head> <body onload="test()"> <svg:svg version="1.1" width="100px" height="100px" ...
Event - Web APIs
yevent domtransactionevent dragevent editingbeforeinputevent errorevent fetchevent focusevent gamepadevent hashchangeevent idbversionchangeevent inputevent keyboardevent mediastreamevent messageevent mouseevent mutationevent offlineaudiocompletionevent overconstrainederror pagetransitionevent paymentrequestupdateevent pointerevent popstateevent progressevent relatedevent rt
cdatachannelevent rtcidentityerrorevent rtcidentityevent rtcpeerconnectioniceevent sensorevent storageevent svgevent svgzoomevent timeevent touchevent trackevent transitionevent uievent userproximityevent webglcontextevent wheelevent constructor event() creates an event object, returning it to the caller.
Node.localName - Web APIs
syntax name = element.localname name is the local name as a string (see notes below for details) example (must be served with xml content type, such as text/xml or application/xhtml+xml.) <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <head> <script type="application/javascript"><![
cdata[ function test() { var text = document.getelementbyid('text'); var circle = document.getelementbyid('circle'); text.value = "<svg:circle> has:\n" + "localname = '" + circle.localname + "'\n" + "namespaceuri = '" + circle.namespaceuri + "'"; } ]]></script> </head> <body onload="test()"> <svg:svg version="1.1" width="100px" height="100px" ...
Node.nodeName - Web APIs
values for the different types of nodes are: interface nodename value attr the value of attr.name
cdatasection "#
cdata-section" comment "#comment" document "#document" documentfragment "#document-fragment" documenttype the value of documenttype.name element the value of element.tagname entity the entity name entityreference the name of entity reference notation the notation name processinginstruction the value of processinginstruction.target text "#text" example given the following markup: <div ...
RTCRtpTransceiver - Web APIs
each sdp media section describes one bidirectional srtp ("secure real time protocol") stream (excepting the media section for rt
cdatachannel, if present).
RTCStats.id - Web APIs
using the id, you can correlate two or more rtcstats-based objects in order to monitor statistics over time for a given webrtc object, such as an rtp stream, an rtcpeerconnection, or an rt
cdatachannel.
RTCStatsReport - Web APIs
data-channel an rt
cdatachannelstats object which contains statistics about each rt
cdatachannel on the connection.
RTCStatsType - Web APIs
data-channel an rt
cdatachannelstats object which contains statistics about each rt
cdatachannel on the connection.
Range.comparePoint() - Web APIs
if the reference node is a node of type text, comment, or
cdatasection, then offset is the number of characters from the start of reference node.
Range.endOffset - Web APIs
if the endcontainer is a node of type text, comment, or
cdatasection, then the offset is the number of characters from the start of the endcontainer to the boundary point of the range.
Range.setEnd() - Web APIs
usage notes if the endnode is a node of type text, comment, or
cdatasection, then endoffset is the number of characters from the start of endnode.
Range.setStart() - Web APIs
if the startnode is a node of type text, comment, or
cdatasection, then startoffset is the number of characters from the start of startnode.
Range.startOffset - Web APIs
if the startcontainer is a node of type text, comment, or
cdatasection, then the offset is the number of characters from the start of the startcontainer to the boundary point of the range.
SVGLength - Web APIs
svg_lengthtype_exs = 4 svg_lengthtype_px = 5 svg_lengthtype_cm = 6 svg_lengthtype_mm = 7 svg_lengthtype_in = 8 svg_lengthtype_pt = 9 svg_lengthtype_pc = 10 normative document svg 1.1 (2nd edition) example <svg height="200" onload="start();" version="1.1" width="200" xmlns="http://www.w3.org/2000/svg"> <script type="text/javascript"><![
cdata[ function start() { var rect = document.getelementbyid("myrect"); var val = rect.x.baseval; // read x in pixel and cm units console.log("value: " + val.value + ", valueinspecifiedunits: " + val.unittype + ": " + val.valueinspecifiedunits + ", valueasstring: " + val.valueasstring); // set x = 20pt and read it out in pixel and pt units val.newvaluespecifieduni...
SVGTransformList - Web APIs
<svg id="my-svg" viewbox="0 0 300 280" xmlns="http://www.w3.org/2000/svg" version="1.1"> <desc>example showing how to transform svg elements that using svgtransform objects</desc> <script type="application/ecmascript"> <![
cdata[ function transformme(evt) { // svg root element to access the createsvgtransform() function var svgroot = evt.target.parentnode; // svgtransformlist of the element that has been clicked on var tfmlist = evt.target.transform.baseval; // create a seperate transform object for each transform var translate = svgroot.createsvgtransform(); translate.sett...
WebGL2RenderingContext.texImage3D() - Web APIs
sr
cdata); void gl.teximage3d(target, level, internalformat, width, height, depth, border, format, type, arraybufferview sr
cdata, srcoffset); parameters target a glenum specifying the binding point (target) of the active texture.
WebGL2RenderingContext.texSubImage3D() - Web APIs
sr
cdata, optional srcoffset); void gl.texsubimage3d(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, imagebitmap?
WebGLRenderingContext.compressedTexImage[23]D() - Web APIs
pixels); // additionally available in webgl 2: // read from buffer bound to gl.pixel_unpack_buffer void gl.compressedteximage2d(target, level, internalformat, width, height, border, glsizei imagesize, glintptr offset); void gl.compressedteximage2d(target, level, internalformat, width, height, border, arraybufferview sr
cdata, optional srcoffset, optional srclengthoverride); // read from buffer bound to gl.pixel_unpack_buffer void gl.compressedteximage3d(target, level, internalformat, width, height, depth, border, glsizei imagesize, glintptr offset); void gl.compressedteximage3d(target, level, internalformat, width, height, depth, border, arraybufferview sr
cdata, optional srcoffset, opti...
WebGLRenderingContext.compressedTexSubImage2D() - Web APIs
pixels); // additionally available in webgl 2: void gl.compressedtexsubimage2d(target, level, xoffset, yoffset, width, height, format, imagesize, offset); void gl.compressedtexsubimage2d(target, level, xoffset, yoffset, width, height, format, arraybufferview sr
cdata, optional srcoffset, optional srclengthoverride); parameters target a glenum specifying the binding point (target) of the active compressed texture.
WebGLRenderingContext.texImage2D() - Web APIs
, internalformat, width, height, border, format, type, htmlvideoelement source); void gl.teximage2d(target, level, internalformat, width, height, border, format, type, imagebitmap source); void gl.teximage2d(target, level, internalformat, width, height, border, format, type, imagedata source); void gl.teximage2d(target, level, internalformat, width, height, border, format, type, arraybufferview sr
cdata, srcoffset); parameters target a glenum specifying the binding point (target) of the active texture.
WebGLRenderingContext.texSubImage2D() - Web APIs
d(target, level, xoffset, yoffset, width, height, format, type, htmlvideoelement source); void gl.texsubimage2d(target, level, xoffset, yoffset, width, height, format, type, imagebitmap source); void gl.texsubimage2d(target, level, xoffset, yoffset, width, height, format, type, imagedata source); void gl.texsubimage2d(target, level, xoffset, yoffset, width, height, format, type, arraybufferview sr
cdata, srcoffset); parameters target a glenum specifying the binding point (target) of the active texture.
MIME types (IANA media types) - HTTP
note: use application/xml or application/xhtml+xml if you want xml’s strict parsing rules, <![
cdata[…]]> sections, or elements that aren't from html/svg/mathml namespaces.
alignment-baseline - SVG: Scalable Vector Graphics
x="60" y="10">a hanging</text> <text alignment-baseline="middle" x="60" y="65">a middle</text> <text alignment-baseline="baseline" x="60" y="110">a baseline</text> <!-- materialisation of anchors --> <circle cx="60" cy="10" r="3" fill="red" /> <circle cx="60" cy="65" r="3" fill="red" /> <circle cx="60" cy="110" r="3" fill="red" /> <style><![
cdata[ text{ font: bold 36px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> for object alignment in other elements (such as <text>), see dominant-baseline.
class - SVG: Scalable Vector Graphics
example <html> <body> <svg width="120" height="220" viewport="0 0 120 120" version="1.1" xmlns="http://www.w3.org/2000/svg"> <style type="text/css" > <![
cdata[ rect.rectclass { stroke: #000066; fill: #00cc00; } circle.circleclass { stroke: #006600; fill: #cc0000; } ]]> </style> <rect class="rectclass" x="10" y="10" width="100" height="...
dominant-baseline - SVG: Scalable Vector Graphics
<text dominant-baseline="text-top" x="70" y="270">text-top</text> <!-- materialization of anchors --> <circle cx="60" cy="20" r="3" fill="red" /> <circle cx="60" cy="70" r="3" fill="red" /> <circle cx="60" cy="120" r="3" fill="red" /> <circle cx="60" cy="170" r="3" fill="red" /> <circle cx="60" cy="220" r="3" fill="red" /> <circle cx="60" cy="270" r="3" fill="red" /> <style><![
cdata[ text { font: bold 30px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> result specifications specification status comment scalable vector graphics (svg) 2the definition of 'dominant-baseline' in that specification.
id - SVG: Scalable Vector Graphics
<svg width="120" height="120" viewbox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <style type="text/css"> <![
cdata[ #smallrect { stroke: #000066; fill: #00cc00; } ]]> </style> <rect id="smallrect" x="10" y="10" width="100" height="100" /> </svg> usage notes value <id> default value none animatable no <id> specifies the element's id.
text-anchor - SVG: Scalable Vector Graphics
l90,110" stroke="grey" /> <!-- anchors in action --> <text text-anchor="start" x="60" y="40">a</text> <text text-anchor="middle" x="60" y="75">a</text> <text text-anchor="end" x="60" y="110">a</text> <!-- materialisation of anchors --> <circle cx="60" cy="40" r="3" fill="red" /> <circle cx="60" cy="75" r="3" fill="red" /> <circle cx="60" cy="110" r="3" fill="red" /> <style><![
cdata[ text { font: bold 36px verdana, helvetica, arial, sans-serif; } ]]></style> </svg> usage notes default value start value start | middle | end animatable yes start the rendered characters are aligned such that the start of the text string is at the initial current text position.
<script> - SVG: Scalable Vector Graphics
while svg's script element is equivalent to the html <script> element, it has some discrepancies, like it uses the href attribute instead of src and it doesn't support ecmascript modules so far (see browser compatibility below for details) html,body,svg { height:100% } <svg viewbox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <script> // <![
cdata[ window.addeventlistener('domcontentloaded', () => { function getcolor () { const r = math.round(math.random() * 255).tostring(16).padstart(2,'0') const g = math.round(math.random() * 255).tostring(16).padstart(2,'0') const b = math.round(math.random() * 255).tostring(16).padstart(2,'0') return `#${r}${g}${b}` } document.queryselector('circle').addeventliste...
Fills and Strokes - SVG: Scalable Vector Graphics
<?xml version="1.0" standalone="no"?> <svg width="200" height="200" xmlns="http://www.w3.org/2000/svg" version="1.1"> <defs> <style type="text/css"><![
cdata[ #myrect { stroke: black; fill: red; } ]]></style> </defs> <rect x="10" height="180" y="10" width="180" id="myrect"/> </svg> moving styles to an area like this can make it easier to adjust properties on large groups of elements.
Gradients in SVG - SVG: Scalable Vector Graphics
t="0%"/> <stop class="stop2" offset="50%"/> <stop class="stop3" offset="100%"/> </lineargradient> <lineargradient id="gradient2" x1="0" x2="0" y1="0" y2="1"> <stop offset="0%" stop-color="red"/> <stop offset="50%" stop-color="black" stop-opacity="0"/> <stop offset="100%" stop-color="blue"/> </lineargradient> <style type="text/css"><![
cdata[ #rect1 { fill: url(#gradient1); } .stop1 { stop-color: red; } .stop2 { stop-color: black; stop-opacity: 0; } .stop3 { stop-color: blue; } ]]></style> </defs> <rect id="rect1" x="10" y="10" rx="15" ry="15" width="100" height="100"/> <rect x="10" y="120" rx="15" ry="15" width="100" height="100" fill="url(#gradient2)"/> </svg> screenshotlive sample ab...
xml:base - XML: Extensible Markup Language
<svg xml:base="https://foobar.s3-eu-west-1.amazonaws.com/uploads/15066845653629" width="909" height="1286" viewbox="0 0 909 1286"xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <style type="text/css"><![
cdata[ .s9_999{ font-size: 9.17px; font-family: zapfdingbats_ghr; fill: #161615; } ]]></style> <text x="647" y="412" dx="0" class="s9_999" >r</text> <style type="text/css"><![
cdata[ @font-face { font-family: zapfdingbats_ghr; src: url("fonts/zapfdingbats_ghr.woff") format("woff"); } ]]></style> </svg> setting the xml:base on the svg element means you can inline the s...