Search completed in 1.02 seconds.
852 results for "zero":
Your results are loading. Please wait...
JSVAL_ZERO
obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the jsval that represents the javascript number 0. ...
... obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the jsval that represents the javascript number 0. ...
... obsolete since jsapi 42this feature is obsolete. although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the jsval that represents the javascript number 0. ...
dateLeadingZero - Archive of obsolete content
...
... ...
hourLeadingZero - Archive of obsolete content
...
... ...
minuteLeadingZero - Archive of obsolete content
...
... ...
monthLeadingZero - Archive of obsolete content
...
... ...
secondLeadingZero - Archive of obsolete content
...
... ...
yearLeadingZero - Archive of obsolete content
...
... ...
JSID_IS_ZERO
test whether a js id is a zero id. syntax bool jsid_is_zero(jsid id); name type description id jsid the property identifier to test. description jsid_is_zero tests whether a specified js id, id, is zero (0 in its integer representation). ...
... test whether a js id is a zero id. syntax bool jsid_is_zero(jsid id); name type description id jsid the property identifier to test. description jsid_is_zero tests whether a specified js id, id, is zero (0 in its integer representation). ...
sslfnc.html
returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain the error code. description the cipherprefsetdefault function enables or disables individual cipher suites globally. you typically call this in response to changes in us...
...h_des_cbc_sha tls_rsa_export1024_with_rc4_56_sha tls_rsa_export1024_with_des_cbc_sha ssl_rsa_export_with_rc4_40_md5 ssl_rsa_export_with_rc2_cbc_40_md5 ssl_fortezza_dms_with_null_sha ssl_rsa_with_null_sha (not enabled by default) ssl_rsa_with_null_md5 (not enabled by default) enabled if nonzero, the specified cipher is enabled. if zero, the cipher is disabled. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain the error code. description the cipherprefsetdefault function enables or disables individual cipher suites globally. you typically call this in response to changes in user-controlled settings. you must call this...
...ol *enabled); parameters this function has the parameters listed below. cipher the cipher suite whose default preference setting you want to get. for a list of the cipher suites you can specify, see ssl_cipherprefsetdefault. enabled a pointer to the default value associated with the cipher specified in the cipher parameter. if nonzero, the specified cipher is enabled. if zero, the cipher is disabled. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to obtain error code. description ssl_cipherprefgetdefault performs the complementary function to ssl_cipherprefsetdefault. it returns the application process' current default pre...
...And 14 more matches
Index - Web APIs
Web › API › Index
n audiotracklist. 202 audioworklet api, audio, audioworklet, experimental, interface, reference, web audio api, worklet the audioworklet interface of the web audio api is used to supply custom audio processing scripts. user-supplied code is run in the audioworkletglobalscope global execution context in a separate web audio rendering thread along with other nodes, allowing for zero-latency audio processing. 203 audioworkletglobalscope api, audioworkletglobalscope, experimental, interface, reference, web audio api the audioworkletglobalscope interface of the web audio api represents a global execution context for user-supplied code, which defines custom audioworkletprocessor-derived classes. each baseaudiocontext has a single audioworklet available under...
...his value is null if the implementation doesn't support measuring altitude. 671 coordinates.heading api, coordinates, geolocation api, property, secure context, heading the coordinates.heading read-only property is a double representing the direction in which the device is traveling. this value, specified in degrees, indicates how far off from heading due north the device is. zero degrees represents true true north, and the direction is determined clockwise (which means that east is 90 degrees and west is 270 degrees). if coordinates.speed is 0, heading is nan. if the device is not able to provide heading information, this value is null. 672 coordinates.latitude api, coordinates, geolocation api, property, secure context, latitude the coordinates.latit...
...a drag operation. the list includes one item for each item in the operation and if the operation had no items, the list is empty. 791 datatransfer.mozcleardataat() api, method, non-standard, reference, drag and drop the datatransfer.mozcleardataat() method removes the data associated with the given format for an item at the specified index. the index must be in the range from zero to the number of items minus one. 792 datatransfer.mozcursor api, non-standard, property, reference, drag and drop the datatransfer.mozcursor property returns or sets the drag cursor's state. this is primarily used to control the cursor during tab drags. 793 datatransfer.mozgetdataat() api, method, non-standard, reference, drag and drop the datatransfer.m...
...And 11 more matches
mozIStorageStatement
atement which releases all resources that were allocated for it. you must call this method on every active statement before you try to call mozistorageconnection.close(). void finalize(); note: this method does not need to be used from native callers because you have to release the statement in order to not leak. finalize will be called for you when the reference count on the statement goes to zero. clone() creates a copy of the statement whose state will be mozistoragestatement.moz_storage_statement_ready. mozistoragestatement clone(); return value a mozistoragestatement that is a copy of the current statement. getparametername() obtains the name of the parameter for the specified index. autf8string getparametername( in unsigned long aparamindex ); parameters aparamindex ...
...lone() creates a copy of the statement whose state will be mozistoragestatement.moz_storage_statement_ready. mozistoragestatement clone(); return value a mozistoragestatement that is a copy of the current statement. getparametername() obtains the name of the parameter for the specified index. autf8string getparametername( in unsigned long aparamindex ); parameters aparamindex the zero-based numerical index for the parameter to be bound. this will be one less than the number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). return value an autf8string representing the parameter name for the specified index. getparameterindex() obtains the index of the parameter with the specified name. this method was added in 1.9.0. in 1.8.1 you had to use getparamete...
... added in 1.9.0. in 1.8.1 you had to use getparameterindexes(). see bug 388048 for details. unsigned long getparameterindex( in autf8string aname ); parameters aname name of the parameter to get the index for. for parameter 'foo', name's format is ':foo' in 1.9.0 and 1.9.1. in 1.9.2 the ':' was dropped and name's value should be just 'foo'. see bug 528166 for details. return value the zero-based numerical index for the parameter to be bound. this will be one less than the number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). getcolumnname() obtains the name of the column for the specified index. autf8string getcolumnname( in unsigned long acolumnindex ); parameters acolumnindex the zero-based numerical index for the column to get data from. re...
...And 8 more matches
Functions - JavaScript
ous function. param the name of an argument to be passed to the function. statements the statements comprising the body of the function. the arrow function expression (=>) an arrow function expression has a shorter syntax and lexically binds its this value (see arrow functions for details): ([param[, param]]) => { statements } param => expression param the name of an argument. zero arguments need to be indicated with (). for only one argument, the parentheses are not required. (like foo => 1) statements or expression multiple statements need to be enclosed in brackets. a single expression requires no brackets. the expression is also the implicit return value of the function. the function constructor note: using the function constructor to create functions is not reco...
... function. the function constructor note: using the function constructor to create functions is not recommended since it needs the function body as a string which may prevent some js engine optimizations and can also cause other problems. as all other objects, function objects can be created using the new operator: new function (arg1, arg2, ... argn, functionbody) arg1, arg2, ... argn zero or more names to be used by the function as formal parameters. each must be a proper javascript identifier. functionbody a string containing the javascript statements comprising the function body. invoking the function constructor as a function (without using the new operator) has the same effect as invoking it as a constructor. the generatorfunction constructor note: generatorfunction ...
... detail). note: using the generatorfunction constructor to create functions is not recommended since it needs the function body as a string which may prevent some js engine optimizations and can also cause other problems. as all other objects, generatorfunction objects can be created using the new operator: new generatorfunction (arg1, arg2, ... argn, functionbody) arg1, arg2, ... argn zero or more names to be used by the function as formal argument names. each must be a string that conforms to the rules for a valid javascript identifier or a list of such strings separated with a comma; for example "x", "thevalue", or "a,b". functionbody a string containing the javascript statements comprising the function definition. invoking the generatorfunction constructor as a function (...
...And 8 more matches
Math.clz32() - JavaScript
if x is not a number, then it will be converted to a number first, then converted to a 32-bit unsigned integer. ...
... if x is not a number, then it will be converted to a number first, then converted to a 32-bit unsigned integer. if the converted 32-bit unsigned integer is 0, then return 32, because all bits are 0. ...
...tive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.clz32(x) parameters x a number. return value the number of leading zero bits in the 32-bit binary representation of the given number. description "clz32" is short for countleadingzeroes32. if x is not a number, then it will be converted to a number first, then converted to a 32-bit unsigned integer. if the converted 32-bit unsigned integer is 0, then return 32, because all bits are 0. this function is particularly useful for systems that compile to js, like emscripten. count leading ones and beyond at present, there is no math.clon for "count leading ones" (named "clon", ...
...And 8 more matches
MMgc - Archive of obsolete content
tly freed, although it can be freed with free if it is known that there are no other references to it. alloc is often used to allocate arrays and other objects of variable size that contain gc pointers or are otherwise desirable to have in managed memory. these flags may be passed to alloc to control the allocation type. /** * flags to be passed as second argument to alloc */ enum allocflags { kzero=1, kcontainspointers=2, kfinalize=4, krcobject=8 }; kzero zeros out the memory. otherwise, the memory contains undefined values. kcontainspointers indicates to the gc that the memory will contain pointers to other gc objects, and thus needs to be scanned by the gc's mark phase. if you know for certain that the objects will not contain gc pointers, leave this flag off; it will make the mark...
...any pointer to a rcobject from managed (gc) memory must use the drcwb macro. this is true whether the object containing the pointer is gcobject or rcobject. class myobject : public mmgc::rcobject { ... }; class myothermanagedgcobject : public mmgc::gcobject { drcwb(myobject*) myobject; }; class myothermanagedrcobject : public mmgc::rcobject { drcwb(myobject*) myobject; }; the rcobject must zero itself out on deletion. for this reason, rcobject's always have finalizers. declare a destructor that zeros out all of the fields of your rcobject. see zeroing rcobjects for more information. class myobject : public mmgc::rcobject { public: myobject() { x = 1; y = 2; z = 3; } ~myobject() { x = y = z = 0; } private: int x; int y; int z; }; gcroot if you have a pointer to a gcobject from an...
...arked at the end of the mark phase, and not incrementally, so no write barriers are required. drc() is required for rc objects, since the reference count must be maintained. write barriers are not needed for c++ objects that exist purely on the stack, and never in the heap. the flash player class "nativeinfo" is a good example. such objects are essentially the same as stack-based local variables. zeroing rcobjects all rcobjects (including all subclasses) must zero themselves out completely upon destruction. asserts enforce this. the reason is that our collector zeroes memory upon free and this was hurting performance. since mmgc must traverse objects to decrement refcounts properly upon destruction, i just made destructors do zeroing too. this mostly applies to non-pointer fields as drcwb smar...
...And 6 more matches
Equality comparisons and sameness - JavaScript
which operation you choose depends on what sort of comparison you are looking to perform. briefly: double equals (...
...null === undefined); // false console.log(obj === null); // false console.log(obj === undefined); // false strict equality is almost always the correct comparison operation to use. for all values except numbers, it uses the obvious semantics: a value is only equal to itself. for numbers it uses slightly different semantics to gloss over two different edge cases. the first is that floating point zero is either positively or negatively signed. this is useful in representing certain mathematical solutions, but as most situations don't care about the difference between +0 and -0, strict equality treats them as the same value. the second is that floating point includes the concept of a not-a-number value, nan, to represent the solution to certain ill-defined mathematical problems: negative infini...
...ict, and may evaluate more quickly due to the lack of type coercion. same-value equality same-value equality addresses a final use case: determining whether two values are functionally identical in all contexts. ...
...And 6 more matches
Mozilla internal string guide
ested buffer capacity was rounded up to mozjemalloc buckets. this is useful when initially requesting best-case buffer size without yet knowing the true size need. if the data that actually needs to be written is larger than the best-case estimate but still fits within the rounded-up capacity, there is no need to reallocate despite requesting the best-case capacity. cache-friendly means that the zero terminator for c compatibility is written after the new content of the string has been written, so the result is a forward-only linear write access pattern instead of a non-linear back-and-forth sequence resulting from using setlength() followed by beginwriting(). low-level means that writing via a raw pointer is possible as with beginwriting(). bulkwrite() takes four arguments: the new capacit...
...it string can be in one of many character encodings while a 16-bit string is always in potentially-invalid utf-16. (you can make a 16-bit string guaranteed-valid utf-16 by passing it to ensureutf16validity().) the most common encodings are: ascii - 7-bit encoding for basic english-only strings. each ascii value is stored in exactly one byte in the array with the most-significant 8th bit set to zero. ucs2 - 16-bit encoding for a subset of unicode, bmp. the unicode value of a character stored in ucs2 is stored in exactly one 16-bit char16_t in a string class. utf-8 - 8-bit encoding for unicode characters. each unicode characters is stored in up to 4 bytes in a string class. utf-8 is capable of representing the entire unicode character repertoire, and it efficiently maps to utf-32. (gtk and ...
...has to be regarded as in this encoding instead of ucs2. utf-16 is capable of representing the entire unicode character repertoire, and it efficiently maps to utf-32. (win32 w apis and mac os x natively use utf-16.) latin1 - 8-bit encoding for the first 256 unicode code points. used for http headers and for size-optimized storage in text node and spidermonkey strings. latin1 converts to utf-16 by zero-extending each byte to a 16-bit code unit. note that this kind of "latin1" is not available for encoding html, css, js, etc. specifying charset=latin1 means the same as charset=windows-1252. windows-1252 is a similar but different encoding used for interchange. in addition, there exist multiple other (legacy) encodings. the web-relevant ones are defined in the encoding standard. conversions fro...
...And 5 more matches
Lexical grammar - JavaScript
tors, comments or white space. ecmascript also defines certain keywords and literals and has rules for automatic insertion of semicolons to end statements. control characters control characters have no visual representation but are used to control the interpretation of the text. unicode format-control characters code point name abbreviation description u+200c zero width non-joiner <zwnj> placed between characters to prevent being connected into ligatures in certain languages (wikipedia). u+200d zero width joiner <zwj> placed between characters that would not normally be connected in order to cause the characters to be rendered using their connected form in certain languages (wikipedia). u+feff byte order mark <bom> ...
... a few identifiers have a special meaning in some contexts without being keywords of any kind. they include: arguments get set literals null literal see also null for more information. null boolean literal see also boolean for more information. true false numeric literals the number and bigint types use numeric literals. decimal 1234567890 42 // caution when using with a leading zero: 0888 // 888 parsed as decimal 0777 // parsed as octal, 511 in decimal note that decimal literals can start with a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the number is interpreted as an octal number. this won't throw in javascript, see bug 957513. see also the page about parseint() exponential the decimal exponential literal is sp...
...because this syntax is new in ecmascript 2015, see the browser compatibility table, below. if the digits after the 0b are not 0 or 1, the following syntaxerror is thrown: "missing binary digits after 0b". var flt_signbit = 0b10000000000000000000000000000000; // 2147483648 var flt_exponent = 0b01111111100000000000000000000000; // ...
...And 5 more matches
fill-rule - SVG: Scalable Vector Graphics
can be used as a css property. ...
...olygon fill-rule="nonzero" stroke="red" points="50,0 21,90 98,35 2,35 79,90"/> <!-- the center of the shape has two path segments (shown by the red stroke) between it and infinity. it is therefore considered outside the shape, and not filled. ...
...oints="50,0 21,90 98,35 2,35 79,90"/> <!-- the center of the shape has two path segments (shown by the red stroke) between it and infinity. it is therefore considered outside the shape, and not filled. --> <polygon fill-rule="evenodd" stroke="red" points="150,0 121,90 198,35 102,35 179,90"/> </svg> usage notes value nonzero | evenodd default value nonzero animatable yes the fill-rule attribute provides two options for how the inside (that is, the area to be filled) of a shape is determined: nonzero the value nonzero determines the "insideness" of a point in the shape by drawing a ray from that point to infinity in any direction, and then examining the places where a segment of the shape crosses the ray. starting with a count o...
...And 5 more matches
Index
Mozilla › Tech › XPCOM › Index
from the stream. 120 xpcom array guide guide, needscontent, needsmarkupwork, xpcom mozilla has many array classes because each array is optimized for a particular usage pattern. this guide describes the available arrays as well as the enumerator classes that can be used to get to them. in this document the term array refers to a container for multiple objects with a numeric, zero-based index. 121 xpcom changes in gecko 2.0 gecko 2.0, xpcom several changes that affect xpcom component compatibility are taking place in gecko 2. this article details those changes, and provides suggestions for how to update your code. 122 xpcom hashtable guide a hashtable is a data construct that stores a set of items. each item has a key that identif...
...limited to editable objects. the substrings used with this interface are specified as follows: if startoffset is less than endoffset, the substring starts with the character at startoffset and ends with the character just before endoffset. if endoffset is lower than startoffset, the result is the same as a call with the two arguments exchanged. the whole text can be defined by passing the indices zero and iaccessibletext.ncharacters(). if both indices have the same value, an empty string is defined. refer to the @ref _specialoffsets "special offsets for use in the iaccessibletext and iaccessibleeditabletext methods" for information about a special offset constant that can be used in iaccessibleeditabletext methods. 166 iaccessiblehyperlink interfaces, xpcom, xpcom interface refe...
... array of all this node's children. 253 defaultkeybinding provides localized string of global keyboard accelerator for default action, such as ctrl+o for open file (ctrl + o). 254 description accessible description -- long text associated with this node. 255 doaction this method performs the accessible action at the given zero-based index. action number 0 is the default action. 256 extendselection this method extends the current selection from its current accessible anchor node to this accessible. 257 firstchild returns first child node in accessible tree. 258 focusedchild focused accessible child of node. 259 getaccessibleabove thi...
...And 4 more matches
mozIStorageBindingParams
yname(in autf8string aname); native code only! void bindstringbyname(in autf8string aname, in astring avalue); native code only! void bindutf8stringbyname(in autf8string aname, in autf8string avalue); native code only! methods bindbyindex() binds a to the specified index. void bindbyindex( in unsigned long aindex, in nsivariant avalue ); parameters aindex the zero-based numerical index for the parameter to be bound. this will be one less than the number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). avalue to be bound to the specified index. bindblobbyindex() binds a blob to the specified index. void bindblobbyindex( in unsigned long aindex, [array, const, size_is(avaluesize)] in octet avalue, in unsigned long avaluesi...
...ameter to be bound. this will be one less than the number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). avalue to be bound to the specified index. bindblobbyindex() binds a blob to the specified index. void bindblobbyindex( in unsigned long aindex, [array, const, size_is(avaluesize)] in octet avalue, in unsigned long avaluesize ); parameters aindex the zero-based numerical index for the parameter to be bound. this will be one less than the number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). avalue to be bound to the specified index. avaluesize the size of avalue. native code only!binddoublebyindex binds a double to the specified index. void binddoublebyindex( in unsigned long aindex, in double avalue ); paramete...
...ndex for the parameter to be bound. this will be one less than the number used in the sql (<code>?1</code> maps to <code>0</code>, and so on). avalue to be bound to the specified index. avaluesize the size of avalue. native code only!binddoublebyindex binds a double to the specified index. ...
...And 4 more matches
WindowOrWorkerGlobalScope.setTimeout() - Web APIs
called from an execution context separate from the function from which settimeout was called. the usual rules for setting the this keyword for the called function apply, and if you have not set this in the call or with bind, it will default to the window (or global) object. it will not be the same as the this value for the function that called settimeout. see the following example: myarray = ['zero', 'one', 'two']; myarray.mymethod = function (sproperty) { alert(arguments.length > 0 ? this[sproperty] : this); }; myarray.mymethod(); // prints "zero,one,two" myarray.mymethod(1); // prints "one" the above works because when mymethod is called, its this is set to myarray by the call, so within the function, this[sproperty] is equivalent to myarray[sproperty]. however, in the following: set...
...call(myarray, myarray.mymethod, 2.0*1000); // error: "ns_error_xpc_bad_op_on_wn_proto: illegal operation on wrappednative prototype object" settimeout.call(myarray, myarray.mymethod, 2.5*1000, 2); // same error possible solutions a common way to solve the problem is to use a wrapper function that sets this to the required value: settimeout(function(){myarray.mymethod()}, 2.0*1000); // prints "zero,one,two" after 2 seconds settimeout(function(){myarray.mymethod('1')}, 2.5*1000); // prints "one" after 2.5 seconds arrow functions are a possible alternative, too: settimeout(() => {myarray.mymethod()}, 2.0*1000); // prints "zero,one,two" after 2 seconds settimeout(() => {myarray.mymethod('1')}, 2.5*1000); // prints "one" after 2.5 seconds another possible way to solve the "this" problem is t...
...all(arguments, 2); return __nativesi__(vcallback instanceof function ? function () { vcallback.apply(othis, aargs); } : vcallback, ndelay); }; note: these two replacements will also enable the html5 standard passage of arbitrary arguments to the callback functions of timers in ie. so they can be used as polyfills also. see the callback arguments paragraph. ...
...And 4 more matches
Expressions and operators - JavaScript
etic operators an arithmetic operator takes numerical values (either literals or variables) as their operands and returns a single numerical value. the standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/). these operators work as they do in most other programming languages when used with floating point numbers (in particular, note that division by zero produces infinity). for example: 1 / 2; // 0.5 1 / 2 == 1.0 / 2.0; // this is true in addition to the standard arithmetic operations (+, -, *, /), javascript provides the arithmetic operators listed in the following table: arithmetic operators operator description example remainder (%) binary operator. returns the integer remainder of dividing the two operands.
...urns -3. unary plus (+) unary operator. attempts to convert the operand to a number, if it is not already. +"3" returns 3. +true returns 1. exponentiation operator (**) calculates the base to the exponent power, that is, baseexponent 2 ** 3 returns 8. 10 ** -1 returns 0.1. bitwise operators a bitwise operator treats their operands as a set of 32 bits (zeros and ones), rather than as decimal, hexadecimal, or octal numbers. for example, the decimal number nine has a binary representation of 1001. bitwise operators perform their operations on such binary representations, but they return standard javascript numerical values. the following table summarizes javascript's bitwise operators. bitwise operators operator usage description ...
...ir operations on such binary representations, but they return standard javascript numerical values. the following table summarizes javascript's bitwise operators. bitwise operators operator usage description bitwise and a & b returns a one in each bit position for which the corresponding bits of both operands are ones. bitwise or a | b returns a zero in each bit position for which the corresponding bits of both operands are zeros. bitwise xor a ^ b returns a zero in each bit position for which the corresponding bits are the same. [returns a one in each bit position for which the corresponding bits are different.] bitwise not ~ a inverts the bits of its operand. left shift a << b shifts a in bin...
...And 4 more matches
Numbers and dates - JavaScript
t, however; for example, you can't mix and match bigint and number values in the same operation, and you can't use the math object with bigint values. see also javascript data types and structures for context with other primitive types in javascript. you can use four types of number literals: decimal, binary, octal, and hexadecimal. ...
...alues. see also javascript data types and structures for context with other primitive types in javascript. you can use four types of number literals: decimal, binary, octal, and hexadecimal. decimal numbers 1234567890 42 // caution when using leading zeros: 0888 // 888 parsed as decimal 0777 // parsed as octal in non-strict mode (511 in decimal) note that decimal literals can start with a zero (0) followed by another decimal digit, but if every digit after the leading 0 is smaller than 8, the number gets parsed as an octal number. binary numbers binary number syntax uses a leading zero followed by a lowercase or uppercase latin letter "b" (0b or 0b). if the digits after the 0b are not 0 or 1, the following syntaxerror is thrown: "missing binary digits after 0b". var flt_signbit = 0...
... latin letter "b" (0b or 0b). if the digits after the 0b are not 0 or 1, the following syntaxerror is thrown: "missing binary digits after 0b". var flt_signbit = 0b10000000000000000000000000000000; // 2147483648 var flt_exponent = 0b01111111100000000000000000000000; // 2139095040 var flt_mantissa = 0b00000000011111111111111111111111; // 8388607 octal numbers octal number syntax uses a leading zero. if the digits after the 0 are outside the range 0 through 7, the number will be interpreted as a decimal number. var n = 0755; // 493 var m = 0644; // 420 strict mode in ecmascript 5 forbids octal syntax. octal syntax isn't part of ecmascript 5, but it's supported in all browsers by prefixing the octal number with a zero: 0644 === 420 and "\045" === "%". in ecmascript 2015, octal numbers are ...
...And 4 more matches
Index - Archive of obsolete content
properties, xul reference no summary! 1404 customtoolbarcount needshelp, xul properties, xul reference no summary! 1405 database xul properties, xul reference no summary! 1406 datasources xul properties, xul reference no summary! 1407 date xul properties, xul reference no summary! 1408 dateleadingzero xul properties, xul reference no summary! 1409 datevalue xul properties, xul reference no summary! 1410 datepicker.open xul properties, xul reference no summary! 1411 datepicker.value xul properties, xul reference no summary! 1412 decimalplaces xul properties, xul reference no summary! 1413 de...
...en xul properties, xul reference no summary! 1450 hideseconds xul properties, xul reference no summary! 1451 highlightnonmatches xul properties, xul reference no summary! 1452 homepage xul properties, xul reference no summary! 1453 hour xul properties, xul reference no summary! 1454 hourleadingzero xul properties, xul reference no summary! 1455 id xul properties, xul reference no summary! 1456 ignoreblurwhilesearching xul properties, xul reference no summary! 1457 image xul properties, xul reference no summary! 1458 increment xul properties, xul reference no summary! 1459 inputfield ...
...n xul properties, xul reference no summary! 1491 minheight xul properties, xul reference no summary! 1492 minresultsforpopup xul properties, xul reference no summary! 1493 minwidth xul properties, xul reference no summary! 1494 minute xul properties, xul reference no summary! 1495 minuteleadingzero xul properties, xul reference no summary! 1496 mode xul properties, xul reference no summary! 1497 month xul properties, xul reference no summary! 1498 monthleadingzero xul properties, xul reference no summary! 1499 name reference, référence(2), xul properties, xul reference no summary! 1500 ...
...And 3 more matches
mozIStorageValueArray
0 null data type. value_type_integer 1 integer data type. value_type_float 2 float data type. value_type_text 3 text data type. value_type_blob 4 blob data type. methods gettypeofindex() returns the type of the value at the given column index. long gettypeofindex( in unsigned long aindex ); parameters aindex the zero-based numerical index for the column to get the data from. return value one of the constants mozistoragevaluearray.value_type_null, mozistoragevaluearray.value_type_integer, mozistoragevaluearray.value_type_float, mozistoragevaluearray.value_type_text, or mozistoragevaluearray.value_type_blob describing the type aindex is. getint32() obtains a int32 from the specified index. long getint3...
... return value one of the constants mozistoragevaluearray.value_type_null, mozistoragevaluearray.value_type_integer, mozistoragevaluearray.value_type_float, mozistoragevaluearray.value_type_text, or mozistoragevaluearray.value_type_blob describing the type aindex is. getint32() obtains a int32 from the specified index. long getint32( in unsigned long aindex ); parameters aindex the zero-based numerical index for the column to get the data from. return value the int32 for the specified entry. getint64() obtains a int64 from the specified index. long long getint64( in unsigned long aindex ); parameters aindex the zero-based numerical index for the column to get the data from. return value the int64 for the specified entry. getdouble() obtains a double from th...
...ified entry. getint64() obtains a int64 from the specified index. long long getint64( in unsigned long aindex ); parameters aindex the zero-based numerical index for the column to get the data from. return value the int64 for the specified entry. getdouble() obtains a double from the specified index. double getdouble( in unsigned long aindex ); parameters aindex the zero-based numerical index for the column to get the data from. return value the double for the specified entry. getutf8string() obtains a utf8string from the specified index. ...
...And 3 more matches
stroke-linecap - SVG: Scalable Vector Graphics
the following pink lines highlight the position of the path for each stroke --> <path d="m1,1 h4 m1,3 h4 m1,5 h4" stroke="pink" stroke-width="0.025" /> </svg> usage notes value butt | round | square default value butt animatable yes butt the butt value indicates that the stroke for each subpath does not extend beyond its two endpoints. ...
... indicates that the stroke for each subpath does not extend beyond its two endpoints. on a zero length subpath, the path will not be rendered at all. ...
...e path for each stroke --> <path d="m1,1 h4" stroke="pink" stroke-width="0.025" /> <circle cx="1" cy="1" r="0.05" fill="pink" /> <circle cx="5" cy="1" r="0.05" fill="pink" /> <circle cx="3" cy="3" r="0.05" fill="pink" /> </svg> round the round value indicates that at the end of each subpath the stroke will be extended by a half circle with a diameter equal to the stroke width. ...
...And 3 more matches
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
xul properties, xul reference no summary! 673 customtoolbarcount needshelp, xul properties, xul reference no summary! 674 database xul properties, xul reference no summary! 675 datasources xul properties, xul reference no summary! 676 date xul properties, xul reference no summary! 677 dateleadingzero xul properties, xul reference no summary! 678 datevalue xul properties, xul reference no summary! 679 datepicker.open xul properties, xul reference no summary! 680 datepicker.value xul properties, xul reference no summary! 681 decimalplaces xul properties, xul reference no summary! 682 decimal...
... hidden xul properties, xul reference no summary! 719 hideseconds xul properties, xul reference no summary! 720 highlightnonmatches xul properties, xul reference no summary! 721 homepage xul properties, xul reference no summary! 722 hour xul properties, xul reference no summary! 723 hourleadingzero xul properties, xul reference no summary! 724 id xul properties, xul reference no summary! 725 ignoreblurwhilesearching xul properties, xul reference no summary! 726 image xul properties, xul reference no summary! 727 increment xul properties, xul reference no summary! 728 inputfield xul p...
... min xul properties, xul reference no summary! 760 minheight xul properties, xul reference no summary! 761 minresultsforpopup xul properties, xul reference no summary! 762 minwidth xul properties, xul reference no summary! 763 minute xul properties, xul reference no summary! 764 minuteleadingzero xul properties, xul reference no summary! 765 mode xul properties, xul reference no summary! 766 month xul properties, xul reference no summary! 767 monthleadingzero xul properties, xul reference no summary! 768 name reference, référence(2), xul properties, xul reference no summary! 769 next...
...And 2 more matches
Property - Archive of obsolete content
ger completedefaultindex container contentdocument contentprincipal contenttitle contentview contentvieweredit contentviewerfile contentwindow contextmenu control controller controllers crop current currentindex currentitem currentnotification currentpage currentpane currentset currenturi customtoolbarcount database datasources date dateleadingzero datevalue decimalplaces decimalsymbol defaultbutton defaultvalue description dir disableautocomplete disableautocomplete disableautoselect disabled disablekeynavigation dlgtype docshell documentcharsetinfo editable editingcolumn editingrow editingsession editor editortype emptytext deprecated since gecko 2 enablecolumndrag eventnode firstordinalc...
...ntcharsetinfo editable editingcolumn editingrow editingsession editor editortype emptytext deprecated since gecko 2 enablecolumndrag eventnode firstordinalcolumn firstpermanentchild flex focused focuseditem forcecomplete group handlectrlpageupdown handlectrltab hasuservalue height hidden hideseconds highlightnonmatches homepage hour hourleadingzero id ignoreblurwhilesearching image increment inputfield inverted is24hourclock ispm issearching iswaiting itemcount label labelelement lastpermanentchild lastselected left linkedpanel listboxobject locked markupdocumentviewer max maxheight maxlength maxrows maxwidth menu menuboxobject menupopup min minheight minresultsforpopup minwidt...
...rching image increment inputfield inverted is24hourclock ispm issearching iswaiting itemcount label labelelement lastpermanentchild lastselected left linkedpanel listboxobject locked markupdocumentviewer max maxheight maxlength maxrows maxwidth menu menuboxobject menupopup min minheight minresultsforpopup minwidth minute minuteleadingzero mode month monthleadingzero name next nomatch notificationshidden object observes onfirstpage onlastpage open ordinal orient pack pagecount pageid pageincrement pageindex pagestep parentcontainer palette persist persistence placeholder pmindicator popup popupboxobject popupopen position predicate preferenceelements preferencepanes...
...And 2 more matches
Index
ically associated to that task are requested from the associated arena. the implementation of arenas makes sure that all individual memory blocks are tracked. once a task is done, regardless whether it completed or was aborted, the programmer simply needs to release the arena, and all individually allocated blocks will be released automatically. often freeing is combined with immediately erasing (zeroing, zfree) the memory associated to the arena, in order to make it more difficult for attackers to extract keys from a memory dump. nss uses many c data structures. often nss has multiple implementations for the same or similar concepts. for example, there are multiple presentations of certificates, and the nss internals (and sometimes even the application using nss) might have to convert betw...
... the cmsutil command-line uses the s/mime toolkit to perform basic operations, such as encryption and decryption, on cryptographic message syntax (cms) messages. to run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options. options and arguments options options specify an action. option arguments modify an action. the options and arguments for the cmsutil command are defined as follows: -d decode a message. -c encrypt a message. -e envelope a message. -o create a...
...ule database tool. for information on certificate and key database management, see using the certificate database tool. to run the certificate revocation list management tool, type the command crlutil option [arguments] where options and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options, or with the -h option. options and arguments options options specify an action. option arguments modify an action. the options and arguments for the crlutil command are defined as follows: -g create new certificate revocation list(crl). -d delete certificate revocation list ...
...And 2 more matches
Index
l jsapi reference, spidermonkey note that when a custom object is called, a this argument is calculated for it just as if it were a function. that is, the obj argument received by the jsnative is the this argument, not the custom object that was called! 92 jsclass.flags jsapi reference, spidermonkey the flags field is of type uint32_t. its value is the logical or of zero or more of the following constants: 93 jsconstdoublespec jsapi reference, spidermonkey jsconstdoublespecs is used to define a set of double values that are assigned as properties to an object using js_defineconstdoubles. 94 jsconvertop jsapi reference, reference, référence(2), spidermonkey jsconvertop callback specifies conversion behavior for objects h...
...it's a string. 118 jsid_is_symbol jsapi reference, reference, référence(2), spidermonkey jsid_is_symbol tests whether a specified js id, id, is a js symbol, and returns true if it's a js symbol. 119 jsid_is_void jsapi reference, reference, référence(2), spidermonkey jsid_is_void tests whether a specified js id, id, is jsid_void. 120 jsid_is_zero jsapi reference, reference, référence(2), spidermonkey jsid_is_zero tests whether a specified js id, id, is zero (0 in its integer representation). 121 jsid_void jsapi reference, reference, référence(2), spidermonkey jsid_void does not occur in js scripts but may be used to indicate the absence of a valid jsid. a void jsid is not a valid id and only arises as an...
...ock jsapi reference, obsolete, spidermonkey jsval_unlock is a deprecated feature that is supported only for backward compatibility with existing applications. to unlock a value, use local roots with js_removeroot. 179 jsval_void jsapi reference, obsolete, spidermonkey jsval_void is a jsval constant that represents the javascript value undefined. 180 jsval_zero jsapi reference, obsolete, spidermonkey jsval_zero is equivalent to int_to_jsval(0). 181 jsversion jsapi reference, spidermonkey the jsversion enumerated type includes the following values. each version has a name, which is a string used by js_stringtoversion and js_versiontostring. 182 jsxdrobjectop jsapi reference, obsolete, reference, référence(2...
...And 2 more matches
WindowOrWorkerGlobalScope.setInterval() - Web APIs
nal arguments which are passed through to the function specified by func once the timer expires. note: passing additional arguments to setinterval() in the first syntax does not work in internet explorer 9 and earlier. if you want to enable this functionality on that browser, you must use a polyfill (see the callback arguments section). return value the returned intervalid is a numeric, non-zero value which identifies the timer created by the call to setinterval(); this value can be passed to windoworworkerglobalscope.clearinterval() to cancel the timeout. it may be helpful to be aware that setinterval() and settimeout() share the same pool of ids, and that clearinterval() and cleartimeout() can technically be used interchangeably. for clarity, however, you should try to always match th...
... in a separate execution context than the function from which it was called. as a consequence, the this keyword for the called function is set to the window (or global) object, it is not the same as the this value for the function that called settimeout. ...
...or global) object, it is not the same as the this value for the function that called settimeout. ...
...And 2 more matches
transform - CSS: Cascading Style Sheets
Web › CSS › transform
ex()> | <rotatey()> | <rotatez()> | <perspective()>where <matrix()> = matrix( <number>#{6} )<translate()> = translate( <length-percentage> , <length-percentage>? )<translatex()> = translatex( <length-percentage> )<translatey()> = translatey( <length-percentage> )<scale()> = scale( <number> , <number>? ...
...rspective()>where <matrix()> = matrix( <number>#{6} )<translate()> = translate( <length-percentage> , <length-percentage>? )<translatex()> = translatex( <length-percentage> )<translatey()> = translatey( <length-percentage> )<scale()> = scale( <number> , <number>? )<scalex()> = scalex( <number> )<scaley()> = scaley( <number> )<rotate()> = rotate( [ <angle> | <zero> ] )<skew()> = skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? ...
...> = translate( <length-percentage> , <length-percentage>? )<translatex()> = translatex( <length-percentage> )<translatey()> = translatey( <length-percentage> )<scale()> = scale( <number> , <number>? )<scalex()> = scalex( <number> )<scaley()> = scaley( <number> )<rotate()> = rotate( [ <angle> | <zero> ] )<skew()> = skew( [ <angle> | <zero> ] , [ <angle> | <zero> ]? ...
...And 2 more matches
The "codecs" parameter in common media types - Web media technologies
tax of the codecs parameter for av1 is defined the av1 codec iso media file format binding specification, section 5: codecs parameter string. av01.p.llt.dd[.m[.ccc[.cp[.tc[.mc[.f]]]]]] this codec parameter string's components are described in more detail in the table below. each component is a fixed number of characters long; if the value is less than that length, it must be padded with leading zeros. av1 codec parameter string components component details p the one-digit profile number: av1 profile numbers profile number description 0 "main" profile; supports yuv 4:2:0 or monochrome bitstreams with bit depth of 8 or 10 bits per component. 1 "high" prof...
...identifier, a period separator (.), followed by the object type indication (oti) value for the specific data format. for most codecs, the oti is a two-digit hexadecimal number; however, it's six hexadecimal digits for avc (h.264). thus, the syntaxes for each of the supported codecs look like this: cccc[.pp]* (generic iso bmff) where cccc is the four-character id for the codec and pp is where zero or more two-character encoded property values go. mp4a.oo[.a] (mpeg-4 audio) where oo is the object type indication value describing the contents of the media more precisely and a is the one-digit audio oti. the possible values for the oti can be found on the mp4 registration authority web site's object types page. for example, opus audio in an mp4 file is mp4a.ad. for further details, see mpeg...
...mber (pp), constraint set flags (cc), and level (ll). see avc profiles for the possible values of pp. the constraint set flags byte is comprised of one-bit boolean flags, with the most significant bit being referred to as flag 0 (or constraint_set0_flag, in some resources), and each successive bit being numbered one higher. currently, only flags 0 through 2 are used; the other five bits must be zero. the meanings of the flags vary depending on the profile being used. the level is a fixed-point number, so a value of 14 (decimal 20) means level 2.0 while a value of 3d (decimal 61) means level 6.1. generally speaking, the higher the level number, the more bandwidth the stream will use and the higher the maximum video dimensions are supported. avc profiles the following are the avc profil...
...And 2 more matches
datepicker - Archive of obsolete content
around described here, i.e., use window.settimeout(actual-event-handler-function, 0); to queue up your event handler to run after the rest of the picker's change event handlers. a monthchange event is fired for the grid and popup datepickers whenever a new month is navigated to or displayed. attributes disabled, firstdayofweek, readonly, type, tabindex, value properties date, dateleadingzero, datevalue, disabled, month, monthleadingzero, open, readonly, tabindex, value, year, yearleadingzero examples <datepicker type="grid" value="2007-03-26"/> attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled, it doe...
...entry fields but an additional dropdown button, which, when pressed, will display a popup calendar grid. value type: string the initial value of the datepicker in the form yyyy-mm-dd. properties date type: integer the currently selected date of the month from 1 to 31. set this property to change the selected date. dateleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the date when it is less than 10. datevalue type: date the date that is currently entered or selected in the datepicker as a date object. disabled type: boolean gets and sets the value of the disabled attribute. month type: in...
...s less than 10. datevalue type: date the date that is currently entered or selected in the datepicker as a date object. disabled type: boolean gets and sets the value of the disabled attribute. month type: integer the currently selected month from 0 to 11. set this property to change the selected month. monthleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the month when it is less than 10. open type: boolean for popup type datepickers, specifies whether the popup is open. set this property to open or close the popup. for non-popup datepickers, this property is always false. readonly type: boolean ...
... value of the tabindex attribute. value type: string the currently selected date in the form yyyy-mm-dd. unlike the month property, months in this value range from 01 to 12. set this property to change the selected date. year type: integer the currently selected year from 1 to 9999. set this property to change the selected year. yearleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the year when it is less than 1000. methods inherited methods addeventlistener(), appendchild(), blur, click, clonenode(), comparedocumentposition, dispatchevent(), docommand, focus, getattribute(), getattributenode(), getattributenodens(), getattributens(), getboundingclientrect(), g...
timepicker - Archive of obsolete content
nstead of the mouse. to avoid this, you can use the workaround described here, i.e., use window.settimeout(actual-event-handler-function, 0); to queue up your event handler to run after the rest of the picker's change event handlers. attributes disabled, hideseconds, increment, readonly, tabindex, value properties amindicator, datevalue, disabled, hideseconds, hour, hourleadingzero, increment, is24hourclock, ispm, minute, minuteleadingzero, pmindicator, readonly, second, secondleadingzero, tabindex, value examples <timepicker value="12:05"/> attributes disabled type: boolean indicates whether the element is disabled or not. if this attribute is set, the element is disabled. disabled elements are usually drawn with grayed-out text. if the element is disabled...
...lected in the datepicker as a date object. disabled type: boolean gets and sets the value of the disabled attribute. hideseconds type: boolean indicates whether the seconds field is visible or not. hour type: integer the currently selected hour from 0 to 23. set this property to change the selected hour. hourleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the hour when it is less than 10. increment type: integer gets and sets the value of the increment attribute. is24hourclock type: boolean a read only value indicating whether a 12-hour or 24-hour clock is used to display times. with a 12-hour c...
...r clock, an extra field allows the user to pick between am and pm. this value is determined from the user's locale. ispm type: boolean if false, the hour is between 0 and 11, and if true, the hour is 12 or greater. minute type: integer the currently selected minute from 0 to 59. set this property to change the selected minute. minuteleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the minute when it is less than 10. pmindicator type: string the string value displayed for hours between noon and midnight, defaulting to pm. this value is determined from the user's locale. readonly type: boolean if set to true, then the user...
...g value displayed for hours between noon and midnight, defaulting to pm. this value is determined from the user's locale. readonly type: boolean if set to true, then the user cannot modify the value of the element. second type: integer the currently selected second from 0 to 59. set this property to change the selected second. secondleadingzero type: boolean a read only value indicating whether a leading zero should be displayed before the second when it is less than 10. tabindex type: integer gets and sets the value of the tabindex attribute. value type: string the currently entered time of the form hh:mm:ss. set this property to change the time. methods inherited met...
ssltyp.html
description certificate structures are shared objects. when an application makes a copy of a particular certificate structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate, the function decrements the reference count and, if the reference count reaches zero as a result, frees the memory. the use of the word "destroy" in function names or in the description of a function often implies reference counting. never alter the contents of a certificate structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. pk11slotinfo an opaque structure representing a physical or logical pkcs #1...
...ntax #include <keyt.h> typedef struct seckeyprivatekeystr seckeyprivatekey; description key structures are not shared objects. when an application makes a copy of a particular key structure that already exists in memory, ssl makes a deep copy--that is, it makes a whole new copy of that object. when you call seckey_destroyprivatekey, the function both frees the memory and sets all the bits to zero. never alter the contents of a key structure. treat the structure as read only. secstatus the return value for many ssl functions. syntax #include <seccomon.h> typedef enum { secwouldblock = -2, secfailure = -1, secsuccess = 0 } secstatus; enumerators the enum includes the following enumerators: secwouldblock reserved for i...
...rns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to retrieve the error code. description this function frees the memory associated with the structure to which the specified item points, when that structure is no longer used. when freeitem is not pr_false, also frees the item structure itself. secitem_zfreeitem zeroes and frees the memory associated with a secitem structure. syntax #include <prtypes.h> secstatus secitem_zfreeitem ( secitem *item, prbool freeitem) parameter this function has the following parameter: item a pointer to a secitem structure. freeitem when pr_false, free only the s...
...structure pointed to. otherwise, free both the structure pointed to and the secitem structure itself. returns the function returns one of these values: if successful, secsuccess. if unsuccessful, secfailure. use pr_geterror to retrieve the error code. description this function is similar to secitem_freeitem, except that it overwrites the structures to be freed with zeroes before it frees them. zeros and frees the memory associated with the structure to which the specified item points, when that structure is no longer used. when freeitem is not pr_false, also zeroes and frees the item structure itself. ...
Using XPCOM Utilities to Make Things Easier
eclaration macros not only saves a tremendous amount of time when you're writing the code, it can also save time if you make changes to your idl file, since the c++ header file will then automatically include the updated list of methods to be supported. the ns_init_isupports macro is also a bit of a special case. historically, it gets called in the constructor for your class and sets mrefcnt to zero. however, a change in xpcom that occurred before mozilla 1.3 makes ns_init_isupports no longer necessary: mrefcnt's type has been changed from an integer to a class that provides its own auto-initialization. if you are building with versions earlier than mozilla 1.3, this macro is still required. the following table summarizes the macro usage in this portion of the weblock.cpp source file: com...
...than mozilla 1.3, this macro is still required. the following table summarizes the macro usage in this portion of the weblock.cpp source file: common xpcom macros ns_impl_isupportsn implements nsisupports for a given class with n number of interfaces ns_decl_isupports declares methods of nsisupports including mrefcnt ns_init_isupports initializes mrefcnt to zero. must be called in class's constructor ns_get_iid returns the iid given the name of an interface. interface must be generated by xpidl using the macros described here, the code for the weblock component has gone from around 340 lines of code to just under 40. clearly from a code maintenance point of view, this kind of reduction is outstanding. the entire source file with these ...
...tatic const nsmodulecomponentinfo components[] = { { "pretty class name", sample_cid, "@company.com/sample", sampleconstructor } }; ns_impl_nsgetmodule(nssamplemodule, components) string classes in xpcom strings are usually thought of as linear sequences of characters. in c++, the string literal "xpcom", for example, consists of 6 consecutive bytes, where `x' is at byte offset zero and a null character is at byte offset 5. other kinds of strings like "wide" strings use two bytes to represent each character, and are often used to deal with unicode strings. the string classes in xpcom are not just limited to representing a null terminated sequence of characters, however. they are fairly complex because they support the gecko layout engine and other subsystems that manage lar...
...n call a .get() method on the nscomptr and have it returned for use as a raw pointer. this raw pointer can then be assigned to a variable and have its reference updated by ns_if_addref. be very careful with the result of .get(), however. you should never call release on this result because it may result in a crash. instead, to explicitly release the object being held by a nscomptr, you can assign zero to that pointer. another nice feature of smart pointers - the part that makes them smart - is that you can queryinterface them quite easily. for example, there are two interfaces for representing a file on a file system, the nsifile and nsilocalfile, and they are both implemented by an object. although we haven't formally introduced these two interfaces, the next code sample shows how simple it ...
imgIContainer
currentframeindex unsigned long the index of the current frame that would be drawn if the image was to be drawn now. read only. obsolete since gecko 2.0 currentframeisopaque boolean whether the current frame is opaque; that is, needs the background painted behind it. read only. height print32 the height of the container rectangle. in the case of any error, zero is returned, and an exception will be thrown. read only. loopcount long number of times to loop the image. note: -1 means forever. obsolete since gecko 2.0 numframes unsigned long the total number of frames in this image. read only. obsolete since gecko 2.0 preferredalphachannelformat gfx_format read only. obsolete since gecko 1.9.2 t...
... numframes unsigned long the total number of frames in this image. read only. obsolete since gecko 2.0 preferredalphachannelformat gfx_format read only. obsolete since gecko 1.9.2 type unsigned short the type of this image (one of the type_* values above). read only. width print32 the width of the container rectangle. in the case of any error, zero is returned, and an exception will be thrown. read only. constants constant value description type_raster 0 enumerated values for the 'type' attribute (below). type_vector 1 flag_none 0x0 flags for imgicontainer operations. meanings: flag_none: lack of flags. flag_sync_decode: forces synchronous/non-progressive d...
... awidth the width of the container in which all the frames will fit. aheight the height of the container in which all the frames will fit. aobserver observer to send animation notifications to. exceptions thrown missing exception missing description lockimage() increments the lock count on the image. an image will not be discarded as long as the lock count is nonzero. note that it is still possible for the image to be undecoded if decode-on-draw() is enabled and the image was never drawn. upon instantiation images have a lock count of zero. void lockimage(); parameters none. exceptions thrown missing exception missing description removeframe() obsolete since gecko 1.9.2 (firefox 3.6 / thunderbird 3.1 / fennec 1.0) void rem...
...tartanimation(); parameters none. exceptions thrown missing exception missing description stopanimation() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) void stopanimation(); parameters none. exceptions thrown missing exception missing description unlockimage() decreases the lock count on the image. if the lock count drops to zero, the image is allowed to discard its frame data to save memory. upon instantiation images have a lock count of zero. it is an error to call this method without first having made a matching lockimage() call. in other words, the lock count is not allowed to be negative. void unlockimage(); parameters none. exceptions thrown missing exception missing description remarks --- see also ...
WebGLRenderingContext.blendFuncSeparate() - Web APIs
mponents separately. syntax void gl.blendfuncseparate(srcrgb, dstrgb, srcalpha, dstalpha); parameters srcrgb a glenum specifying a multiplier for the red, green and blue (rgb) source blending factors. the default value is gl.one. for possible values, see below. dstrgb a glenum specifying a multiplier for the red, green and blue (rgb) destination blending factors. the default value is gl.zero. for possible values, see below. srcalpha a glenum specifying a multiplier for the alpha source blending factor. the default value is gl.one. for possible values, see below. dstalpha a glenum specifying a multiplier for the alpha destination blending factor. the default value is gl.zero. for possible values, see below. return value none. exceptions if srcrgb, dstrgb, srcalpha, or dstal...
... gl.one 1,1,1,1 1 multiplies all colors by 1. gl.src_color rs, gs, bs as multiplies all colors by the source colors. gl.one_minus_src_color 1-rs, 1-gs, 1-bs 1-as multiplies all colors by 1 minus each source color. gl.dst_color rd, gd, bd ad multiplies all colors by the destination c...
... 1 multiplies the rgb colors by the smaller of either the source alpha color or the value of 1 minus the destination alpha color. the alpha value is multiplied by 1. examples to use the blend function, you first have to activate blending with webglrenderingcontext.enable() with the argument gl.blend. ...
... recommendation initial definition. ...
Using media queries - CSS: Cascading Style Sheets
s any available input mechanism allow the user to hover over elements? added in media queries level 4. any-pointer is any available input mechanism a pointing device, and if so, how accurate is it? added in media queries level 4. ...
...atio width-to-height aspect ratio of the viewport color number of bits per color component of the output device, or zero if the device isn't color color-gamut approximate range of colors that are supported by the user agent and output device added in media queries level 4. color-index number of entries in the output device's color lookup table, or zero if the device does not use such a table device-aspect-ratio width-to-height aspect ratio of the output device deprecated in media queries level 4. device-height height of the rendering surface of the output device deprecated in media queries level 4. device-width width of the rendering surface of the output device deprecated in media queries ...
...es the primary input mechanism allow the user to hover over elements? added in media queries level 4. inverted-colors is the user agent or underlying os inverting colors? added in media queries level 5. light-level light level of the environment added in media queries level 5. monochrome bits per pixel in the output device's monochrome frame buffer, or zero if the device isn't monochrome orientation orientation of the viewport overflow-block how does the output device handle content that overflows the viewport along the block axis? added in media queries level 4. overflow-inline can content that overflows the viewport along the inline axis be scrolled? added in media queries level 4. pointer...
...ns they can be prefixed with "min-" or "max-" to express "minimum condition" or "maximum condition" constraints. for example, this css will apply styles only if your browser's viewport width is equal to or narrower than 12450px: @media (max-width: 12450px) { ... } if you create a media feature query without specifying a value, the nested styles will be used as long as the feature's value is not zero (or none, in level 4). for example, this css will apply to any device with a color screen: @media (color) { ... } if a feature doesn't apply to the device on which the browser is running, expressions involving that media feature are always false. for example, the styles nested inside the following query will never be used, because no speech-only device has a screen aspect ratio: @media speech ...
Date and time formats used in HTML - HTML: Hypertext Markup Language
lue always uses the gregorian calendar. while the gregorian calendar wasn't created until the year 1582 (replacing the similar julian calendar), for html's purposes, the gregorian calendar is extended back to the year 1 c.e. make sure any older dates account for this. for the purposes of html dates, years are always at least four digits long; years prior to the year 1000 are padded with leading zeroes ("0"), so the year 72 is written as 0072. years prior to the year 1 c.e. are not supported, so html doesn't support years 1 b.c.e. (1 b.c.) or earlier. a year is normally 365 days long, except during leap years. leap years a leap year is any year which is divisible by 400 or the year is divisible by 4 but not by 100. although the calendar year is normally 365 days long, it actually takes the...
... month strings a month string represents a specific month in time, rather than a generic month of the year. that is, rather than representing simply "january," an html month string represents a month and year paired, like "january 1972." a valid month string consists of a valid year number (a string of at least four digits), followed b...
...epresents december. examples of valid month strings month string month and year 17310-09 september, 17310 2019-01 january, 2019 1993-11 november, 1993 0571-04 april, 571 0001-07 july, 1 c.e. notice that all years are at least four characters long; years that are fewer than four digits long are padded with leading zeroes. date strings a valid date string consists of a month string, followed by a hyphen character ("-", or u+002d), followed by a two-digit day of the month. examples of valid date strings date string full date 1993-11-01 november 1, 1993 1066-10-14 october 14, 1066 0571-04-22 april 22, 571 0062-02-05 february 5, 62 time stri...
...t11:38:00.01 january 28, 1986 at 11:38:00.01 am 1986-01-28 11:38:00.010 1986-01-28t11:38:00.011 january 28, 1986 at 11:38:00.01 am 0170-07-31t22:00:00 0170-07-31t22:002 july 31, 170 at 10:00 pm notice that after normalization, this is the same string as the previous datetime-local string. the space has been replaced with the "t" character and the trailing zero in the fraction of a second has been removed to make the string as short as possible. note that the normalized form of this date drops the ":00" indicating the number of seconds to be zero, because the seconds are optional when zero, and the normalized string minimizes the length of the string. global date and time strings a global date and time string specifies a date and time as well as the...
<input type="time"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › time
if the time includes seconds (see using the step attribute), the format is always hh:mm:ss. you can learn more about the format of the time value used by this input type in time strings in date and time formats used in html. in this example, you can see the time input's valu...
... living standard ...
... living standard ...
... living standard ...
Grammar and types - JavaScript
ed for clarity, not required. literals literals represent values in javascript. these are fixed values—not variables—that you literally provide in your script. this section describes the following types of literals: array literals boolean literals floating-point literals numeric literals object literals regexp literals string literals array literals an array literal is a list of zero or more expressions, each of which represents an array element, enclosed in square brackets ([]). when you create an array using an array literal, it is initialized with the specified values as its elements, and its length is set to the number of arguments specified. the following example creates the coffees array with three elements and a length of three: let coffees = ['french roast', 'colomb...
...an values true and false with the true and false values of the boolean object. the boolean object is a wrapper around the primitive boolean data type. see boolean for more information. numeric literals number and bigint types can be written in decimal (base 10), hexadecimal (base 16), octal (base 8) and binary (base 2). a decimal numeric literal is a sequence of digits without a leading 0 (zero). a leading 0 (zero) on a numeric literal, or a leading 0o (or 0o) indicates it is in octal. octal numerics can include only the digits 0–7. a leading 0x (or 0x) indicates a hexadecimal numeric type. hexadecimal numerics can include digits (0–9) and the letters a–f and a–f. (the case of a character does not change its value. therefore: 0xa = 0xa = 10 and 0xf = 0xf = 15.) a leading 0...
... exponent. the exponent part is an "e" or "e" followed by an integer, which can be signed (preceded by "+" or "-"). a floating-point literal must have at least one digit, and either a decimal point or "e" (or "e"). more succinctly, the syntax is: [(+|-)][digits].[digits][(e|e)[(+|-)]digits] for example: 3.1415926 -.123456789 -3.1e+12 .1e-23 object literals an object literal is a list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}). do not use an object literal at the beginning of a statement! this will lead to an error (or not behave as you expect), because the { will be interpreted as the beginning of a block. the following is an example of an object literal. the first element of the car object defines a property, mycar, ...
... handler, // methods tostring() { // super calls return 'd ' + super.tostring(); }, // computed (dynamic) property names [ 'prop_' + (() => 42)() ]: 42 }; regexp literals a regex literal (which is defined in detail later) is a pattern enclosed between slashes. the following is an example of a regex literal. var re = /ab+c/; string literals a string literal is zero or more characters enclosed in double (") or single (') quotation marks. a string must be delimited by quotation marks of the same type (that is, either both single quotation marks, or both double quotation marks). the following are examples of string literals: 'foo' "bar" '1234' 'one line \n another line' "john's cat" you can call any of the string object's methods on a string literal value.
Indexed collections - JavaScript
llections of data which are ordered by an index value. this includes arrays and array-like constructs such as array objects and typedarray objects. array object an array is an ordered list of values that you refer to with a name and an index. for example, consider an array called emp, which contains employees' names indexed by their numerical employee number. so emp[0] would be employee number zero, emp[1] employee number one, and so on. javascript does not have an explicit array data type. however, you can use the predefined array object and its methods to work with arrays in your applications. the array object has methods for manipulating arrays in various ways, such as joining, reversing, and sorting them. it has a property for determining the array length and other properties for use w...
...ues for the array's elements. when these values are specified, the array is initialized with them as the array's elements. the array's length property is set to the number of arguments. the bracket syntax is called an "array literal" or "array initializer." it's shorter than other forms of array creation, and so is generally preferred. see array literals for details. to create an array with non-zero length, but without any items, either of the following can be used: // this... let arr = new array(arraylength) // ...results in the same array as this let arr = array(arraylength) // this has exactly the same effect let arr = [] arr.length = arraylength note: in the above code, arraylength must be a number. otherwise, an array with a single element (the provided value) will be created. ca...
... // creates an array with only one element: // the number 42. let arr = array(42) // creates an array with no elements // and arr.length set to 42. // // this is equivalent to: let arr = [] arr.length = 42 calling array(n) results in a rangeerror, if n is a non-whole number whose fractional portion is non-zero. the following example illustrates this behavior. let arr = array(9.3) // rangeerror: invalid array length if your code needs to create arrays with single elements of an arbitrary data type, it is safer to use array literals. alternatively, create an empty array first before adding the single element to it. in es2015, you can use the array.of static method to create arrays with single eleme...
....3) // wisenarray contains only one element 9.3 referring to array elements because elements are also properties, you can access the using property accessors. suppose you define the following array: let myarray = ['wind', 'rain', 'fire'] you can refer to the first element of the array as myarray[0], the second element of the array as myarray[1], etc… the index of the elements begins with zero. note: you can also use property accessors to access other properties of the array, like with an object. let arr = ['one', 'two', 'three'] arr[2] // three arr['length'] // 3 populating an array you can populate an array by assigning values to its elements. for example: let emp = [] emp[0] = 'casey jones' emp[1] = 'phil lesh' emp[2] = 'august west' note: if you supply a non-i...
Table Cellmap - Archive of obsolete content
gin is one cell away. this shows that the maximum handled row- or colspan value for a cell is 0xfff8 >> 3 = 8191. there is a special attribute for rowspan="0" and colspan="0", because html 4.0 did introduce a special handling of the 0 value. rowspan = number [cn] this attribute specifies the number of rows spanned by the current cell. the default value of this attribute is one ("1"). ...
...by the current cell. the default value of this attribute is one ("1"). the value zero ("0") means that the cell spans all rows from the current row to the last row of the table section (thead, tbody, or tfoot) in which the cell is defined. colspan = number [cn] this attribute specifies the number of columns spanned by the current cell. the default value of this attribute is one ("1"). the value zero ("0") means that the cell spans all columns from the current column to the last column of the column group (colgroup) in which the cell is defined. the handling of zero spans introduces overhead as one can not mark in advance the corresponding cells as spanned by the zero spans. ...
...ribute is one ("1"). the value zero ("0") means that the cell spans all columns from the current column to the last column of the column group (colgroup) in which the cell is defined. the handling of zero spans introduces overhead as one can not mark in advance the corresponding cells as spanned by the zero spans. the current solution is to use nscellmap::getdataat with a special argument aupdatezerospan to repair the cellmap if it encounters a empty cell (nsnull), by looking for a origin of a zero row- or colspan that spans the queried place in the cellmap. this can produce enormous costs once the cellmap contains large holes that are not caused by zero spans, this is at least a o2(n) algorithm. the following routines seem to be hot spots performance wise: nscellmap::colhasspanningcells n...
BloatView
e sizeof(class). note that this number does not reflect any memory held onto by the class, such as internal buffers, etc. (e.g. for nsstring you'll see the size of the header struct, not the size of the string contents!) bytes leaked - the number of bytes per instance times the number of objects leaked: (bytes per-inst) x (objects rem). use this number to look for the worst offenders. ...
...truct, not the size of the string contents!) bytes leaked - the number of bytes per instance times the number of objects leaked: (bytes per-inst) x (objects rem). use this number to look for the worst offenders. (should be zero!) objects total - the total count of objects allocated of a given class. objects rem - the number of objects allocated of a given class that weren't deleted. (should be zero!) interesting things to look for: are your classes in the list? - look! if they aren't, then you're not using the ns_impl_addref and ns_impl_release (or ns_impl_isupports which calls them) for xpcom objects, or moz_count_ctor and moz_count_dtor for non-xpcom objects. not having your classes in the list is not ok. that means no one is looking at them, and we won't be able to tell if someone i...
...en you're not using the ns_impl_addref and ns_impl_release (or ns_impl_isupports which calls them) for xpcom objects, or moz_count_ctor and moz_count_dtor for non-xpcom objects. not having your classes in the list is not ok. that means no one is looking at them, and we won't be able to tell if someone introduces a leak. (see below for how to fix this.) the bytes leaked for your classes should be zero! - need i say more? if it isn't, you should use the other tools to fix it. the number of objects remaining might not be equal to the total number of objects. this could indicate a hand-written release method (that doesn't use the ns_log_release macro from nstracerefcnt.h), or perhaps you're just not freeing any of the instances you've allocated. these sorts of leaks are easy to fix. the total n...
NSPR Poll Method
rent implementation of pr_poll (the primary user of the poll method) requires that the events in *out_flags reflect the caller's view. this requirement may be relaxed in a future nspr release. to remain compatible with this potential semantic change, nspr clients should only use *out_flags as described in the how to use the poll method section below. ...
...those are the events that the caller should poll the underlying network transport for. these events may be different from the events in in_flags (which reflect the caller's view) for some protocols. ...
...oll_write, &out_flags); if you are interested in calling both pr_recv and pr_send on the same file descriptor, make two separate calls to the poll method, one with pr_poll_read as in_flags and the other with pr_poll_write as in_flags, so that you know what events at the network transport layer pr_poll_read and pr_poll_write are mapped to, respectively. on return, if (new_flags & out_flags) is nonzero, you can try pr_recv or pr_send immediately. otherwise ((new_flags & out_flags) is 0), you should do the following. if new_flags contains pr_poll_read, you should try pr_recv or pr_send when the underlying network transport is readable if new_flags contains pr_poll_write, you should try pr_recv or pr_send when the underlying network transport is writable important do not use out_flags in any ...
nss tech note1
e. const sec_asn1template* templateentry is a pointer to one or more decoder templates. the number of required templates is determined by the type of the first template.when multiple templates are required, the pointer must point to a null-terminated array of templates. the syntax of these templates is identical for both decoders, except where noted. a "null template" is a template that is all zeros, having a zero kind.† the term "null-terminated array", as used throughout this document, means an array of templates, the last of which is a null template. void* dest is a pointer to the target area. this is where the decoder stores its output. the type is undefined as it is completely dependent on the content of the decoder templates.† this typically points to a struct that is described...
...cified in the upper 2 tag bits (number 6 and 7). there are four classes of asn.1 tags : universal, application-specific, context-specific, and private. you can specify the class of the tag using the macros sec_asn1_universal, sec_asn1_application, sec_asn1_context_specific and sec_asn1_private. universal is the default tag class and does not have to be specified, as the value of the class type is zero. the method type : whether the component type is constructed or primitive. this information is stored in the next lowest tag bit (number 5). you can use the macro sec_asn1_constructed for a constructed component type. a sec_asn1_primitive macro is also provided, but does not need to be included as it is zero. the tag number. it is stored in the lower 5 tag bits (number 0 through 4). the asn...
...sed for sec_asn1_sequence or sec_asn1_choice definitions, which always need to be the first template in a template array of their own. sec_asn1_pointer: similar to sec_asn1_inline, except that the memory in the target will be allocated dynamically and a pointer to the dynamically allocated memory will be stored in the dest struct at the offset. this requires that the subtemplate contains a non-zero size field. sec_asn1_group: can only be used in conjunction with a sec_asn1_set or sec_asn1_sequence. it tells the decoder that the component is an asn.1 set of or sequence of respectively. you can also use the macros sec_asn1_set_of and sec_asn1_sequence_of which define both the tag number and this modifier (but still need the method type, this may be a bug). sec_asn1_dynamic or sec_asn1_x...
NSS Tools certutil
tabase management, see using the security module database tool. availability see the release notes for the platforms this tool is available on. syntax to run the certificate database tool, type the command certutil option [arguments ] where options and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options, or with the -h option. options and arguments options specify an action and are uppercase. option arguments modify an action and are lowercase. certificate database tool command options and their arguments are defined as follows: options -n create new certificate and key databas...
...ault value is rsa. by specifying the type of key you can avoid mistakes caused by duplicate nicknames. -l display detailed information when validating a certificate with the -v option. -m serial-number assign a unique serial number to a certificate being created. this operation should be performed by a ca. the default serial number is 0 (zero). serial numbers are limited to integers. -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string with quotation marks if it contains spaces. -o output-file specify the output file name for new certificates or binary certificate requests. bracket theout...
... spaces. the subject identification format follows rfc 1485. -t trustargs specify the trust attributes to modify in an existing certificate or to apply to a certificate when creating it or adding it to a database. there are three available trust categories for each certificate, expressed in this order: "ssl ,email ,object signing ". ...
JSVAL_TRUE
constants that represent the javascript boolean values, true and false. they are equivalent to boolean_to_jsval(true) and boolean_to_jsval(false), respectively. ...
...hat represent the javascript boolean values, true and false. they are equivalent to boolean_to_jsval(true) and boolean_to_jsval(false), respectively. ...
... boolean_to_jsval(false), respectively. take care not to confuse the jsval constants jsval_true and jsval_false with the bool constants true and false. ...
Secure Development Guidelines
a/b : 0; } writing secure code: memory manageme...
...s to be set in windows int main(int argc, char **argv, char **envp) { int fd = open("/etc/shadow", o_rdwr); setreuid(getuid(), getuid()); excve("/bin/sh", argv, envp); } suid root applications file i/o: file descriptors and handles potential overflows when using select fd_set struct, static length, holds a bitmask of fds manipulated with fd_set, fd_isset, fd_clr and fd_zero macros fd_set’s size depends on the operating system if the os allows opening more fds, then fd_set can hold could overflow fd_set file i/o: file descriptors and handles good solution: dynamically allocate fd_set structs int main(void) { int i, fd; fd_set fdset; for( i = 0; i < 2000; i++) { fd = open("/dev/null", o_rdwr); } fd_set(fd, &fdset); } file i...
...on doesn't null terminate. pl_strncat this function is confusing because the size argument is the maximum number of bytes being appended, not the size of the buffer. this can lead to security bugs. pl_strncpyz this function copies a string and guarantees null termination. pl_strcatn the size argument for this function is the size of the buffer and it guarantees zero termination. using the mozilla api mozilla c++ style strings are less prone to buffer overflows and 0-termination issues every string derived from the abstract base class nsastring common read-only methods length() isempty() equals() common methods for modifying the string assign() append() insert() truncate() checking return values often cau...
GetChildAt
if child index is greater than children count then returns null. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ...
...if child index is greater than children count then returns null. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ...
...if child index is greater than children count then returns null. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ...
nsIAccessibleSelectable
children currently selected. read only. constants constant value description eselection_add 0 eselection_remove 1 eselection_getstate 2 methods addchildtoselection() adds the specified accessible child of the object to the object's selection. if the specified object is already selected, then it does nothing. void addchildtoselection( in long index ); parameters index the zero-based accessible child index. exceptions thrown ns_error_failure if the specified object is not selectable. clearselection() clears the selection in the object so that no children in the object are selected. void clearselection(); parameters none. getselectedchildren() returns an nsiarray of the selected nsiaccessible children. nsiarray getselectedchildren(); parameters none. return value an...
... object so that no children in the object are selected. void clearselection(); parameters none. getselectedchildren() returns an nsiarray of the selected nsiaccessible children. nsiarray getselectedchildren(); parameters none. return value an nsiarray. ischildselected() determines if the current child of this object is selected. boolean ischildselected( in long index ); parameters index the zero-based accessible child index. return value true if the child is selected, false if not. refselection() returns a reference to the accessible object representing the specified selected child of the object. nsiaccessible refselection( in long index ); parameters index zero-based selected accessible child index. return value the selected accessible child. removechildfromselection() removes the...
... exceptions thrown ns_error_failure if the specified object is not selectable. selectallselection() select all children. boolean selectallselection(); parameters none. ...
nsIScriptError
the error message in a string format without any context/line number information. note: nsiconsolemessage.message will return the error formatted with file/line information. read only. flags pruint32 flags; see flag constants for a list. read only. innerwindowid unsigned long long the inner window id with which the error is associated. ...
...read only. sourceline astring the line from the file specified by sourcename. you are responsible for providing that line. ...
... you are lazy; that will prevent showing the source line in javascript console. read only. sourcename astring the url of the file in which the error occurred. this will be a hyperlink in the javascript console, so you should use a real url. you may pass null if it's not applicable. read only. timestamp long long elapsed time, in milliseconds, from a platform-specific zero time to the time the message was created. read only. flag constants constant value description errorflag 0x0 error messages. a pseudo-flag for the default, error case. warningflag 0x1 warning messages. exceptionflag 0x2 an exception was thrown for this case - exception-aware hosts can ignore this. strictflag 0x4 o...
AudioWorkletProcessor.process - Web APIs
samples. for example, inputs[n][m][i] will access n-th input, m-th channel of that input, and i-th sample of that channel. each sample value is in range of [-1 .. 1]. the number of inputs and thus the length of that array is fixed at the construction of the node (see audioworkletnodeoptions). ...
... parameters an object containing string keys and float32array values. for each custom audioparam defined using the parameterdescriptors getter, the key in the object is a name of that audioparam, and the value is a float32array. ...
...d. an example of a node with this behaviour is the gainnode. as soon as there are no inputs connected and references retained, gain can no longer be applied to anything, so it can be safely garbage-collected. a node that transforms its input, but has a so-called tail-time — this means that it will produce an output for some time even after its inputs are disconnected or are inactive (producing zero-channels). a processor implementing such a node should return true from the process method for the period of the tail-time, beginning as soon as inputs are found that contain zero-channels. an example of such a node is the delaynode — it has a tail-time equal to its delaytime property. note: an absence of the return statement means that the method returns undefined, and as this is a falsy val...
CanvasRenderingContext2D.fill() - Web APIs
default rule. "evenodd": the even-odd winding rule. path a path2d path to fill. ...
...default rule. "evenodd": the even-odd winding rule. path a path2d path to fill. ...
...t canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); ctx.rect(10, 10, 150, 100); ctx.fill(); result specifying a path and a fillrule this example saves some intersecting lines to a path2d object. the fill() method is then used to render the object to the canvas. a hole is left unfilled in the object's center by using the "evenodd" rule; by default (with the "nonzero" rule), the hole would also be filled. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create path let region = new path2d(); region.moveto(30, 90); region.lineto(110, 20); region.lineto(240, 130); region.lineto(60, 130); region.lineto(190, 20); region.lineto(270, 90); region.closepath(); // fill path c...
Applying styles and colors - Web APIs
there are three possible values for this property: round, bevel and miter. by default this property is set to miter. note that the linejoin setting has no effect if the two connected segments have the same direction, because n...
... there are three possible values for this property: round, bevel and miter. by default this property is set to miter. note that the linejoin setting has no effect if the two connected segments have the same direction, because no joining area will be added in this case. round rounds off the ...
...e we will look at the font property and filltext method in the next chapter about drawing text. canvas fill rules when using fill (or clip and ispointinpath) you can optionally provide a fill rule algorithm by which to determine if a point is inside or outside a path and thus if it gets filled or not. this is useful when a path intersects itself or is nested. two values are possible: "nonzero": the non-zero winding rule, which is the default rule. "evenodd": the even-odd winding rule. in this example we are using the evenodd rule. function draw() { var ctx = document.getelementbyid('canvas').getcontext('2d'); ctx.beginpath(); ctx.arc(50, 50, 30, 0, math.pi * 2, true); ctx.arc(50, 50, 15, 0, math.pi * 2, true); ctx.fill('evenodd'); } <canvas id="canvas" width="100" heig...
Web Video Text Tracks Format (WebVTT) - Web APIs
f them optional, in this order: an optional byte order mark (bom). the string "webvtt". an optional text header to the right of webvtt. there must be at least one space after webvtt. you could use this to add a description to the file. you may use anything in the text header except newlines or the string "-->". a blank line, which is equivalent to two consecutive newlines. zero or more cues or comments. zero or more blank lines. example 1 - simplest possible webvtt file webvtt example 2 - very simple webvtt file with a text header webvtt - this file has no cues. example 3 - common webvtt example with a header and cues webvtt - this file has cues. 14 00:01:14.815 --> 00:01:18.114 - what? - where are we now? 15 00:01:18.171 --> 00:01:20.991 - this is big bat c...
...persand character (&), or the less-than sign (<). if you wish to use such characters, you need to escape them using for example &amp; for ampersand and &lt; for less-than. it is also recommended that you use the greater-than escape sequence (&gt;) instead of the greater-than character (>) to avoid confusion with tags. a comment consists of three parts: the string note. a space or a newline. zero or more characters other than those noted above. example 4 - common webvtt example note this is a comment example 5 - multi-line comment note one comment that is spanning more than one line. note you can also make a comment across more than one line this way. example 6 - common comment usage webvtt - translation of that film i like note this translation was done by kyle so that some fr...
... 00:00:50.000 example 12 - non-overlapping cue timing examples 00:00:00.000 --> 00:00:10.000 00:00:10.000 --> 00:01:00.581 00:01:00.581 --> 00:02:00.100 00:02:01.000 --> 00:02:01.000 cue settings cue settings are optional components used to position where the cue payload text will be displayed over the video. this includes whether the text is displayed horizontally or vertically. there can be zero or more of them, and they can be used in any order so long as each setting is used no more than once. the cue settings are added to the right of the cue timings. there must be one or more spaces between the cue timing and the first setting and between each setting. a setting's name and value are separated by a colon. the settings are case sensitive so use lower case as shown. there are five cue ...
@media - CSS: Cascading Style Sheets
Web › CSS › @media
s any available input mechanism allow the user to hover over elements? added in media queries level 4. any-pointer is any available input mechanism a pointing device, and if so, how accurate is it? added in media queries level 4. ...
...atio width-to-height aspect ratio of the viewport color number of bits per color component of the output device, or zero if the device isn't color color-gamut approximate range of colors that are supported by the user agent and output device added in media queries level 4. color-index number of entries in the output device's color lookup table, or zero if the device does not use such a table device-aspect-ratio width-to-height aspect ratio of the output device deprecated in media queries level 4. device-height height of the rendering surface of the output device deprecated in media queries level 4. device-width width of the rendering surface of the output device deprecated in media queries ...
...es the primary input mechanism allow the user to hover over elements? added in media queries level 4. inverted-colors is the user agent or underlying os inverting colors? added in media queries level 5. light-level light level of the environment added in media queries level 5. monochrome bits per pixel in the output device's monochrome frame buffer, or zero if the device isn't monochrome orientation orientation of the viewport overflow-block how does the output device handle content that overflows the viewport along the block axis? added in media queries level 4. overflow-inline can content that overflows the viewport along the inline axis be scrolled? added in media queries level 4. pointer...
font-feature-settings - CSS: Cascading Style Sheets
ion typediscrete formal syntax normal | <feature-tag-value>#where <feature-tag-value> = <string> [ <integer> | on | off ]? ...
... <feature-tag-value> = <string> [ <integer> | on | off ]? ...
... [ <integer> | on | off ]? ...
font-variant-numeric - CSS: Cascading Style Sheets
e usage of alternate glyphs for numbers, fractions, and ordinal markers. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... either the keyword value normal or one or more of the other values listed below, space-separated, in any order. values normal this keyword leads to the deactivation of the use of such alternate glyphs. ordinal this keyword forces the use of special glyphs for the ordinal markers, like 1st, 2nd, 3rd, 4th in english or a 1a in italian. it corresponds to the opentype values ordn. slashed-zero this keyword forces the use of a 0 with a slash; this is useful when a clear distinction between o and 0 is needed. it corresponds to the opentype values zero. <numeric-figure-values> these values control the figures used for numbers. two values are possible: lining-nums activating the set of figures where numbers are all lying on the baseline. it corresponds to the opentype values lnum. ...
...aller, stacked and separated by a horizontal line. it corresponds to the opentype values afrc. formal definition initial valuenormalapplies toall elements. ...
HTML attribute: multiple - HTML: Hypertext Markup Language
ost browsers displaying a scrolling list box for a <select> control with the multiple attribute set versus a single line dropdown when the attribute is ommitted. the email input displays the same, but will match the :invalid pseudo-class if more than one comma-separated email address is included if the attribute is not present. when multiple is set on the email input type, the user can inlclude zero (if not also required), one or more comma-separated email addresses. <input type="email" multiple name="emails" id="emails"> if and only if the multiple attribute is specified, the value can be a list of properly-formed comma-separated e-mail addresses. any trailing and leading whitespace is removed from each address in the list. when multiple is set on the file input type, the user can select...
...r more files. the user can choose multiple files from the file picker in any way that their chosen platform allows (e.g. by holding down shift or control, and then clicking). <input type="file" multiple name="uploads" id="uploads"> when the attribute is omitted, the user can only select a single file per <input>. the multiple attribute on the <select> element represents a control for selecting zero or more options from the list of options. otherwise, the <select> element represents a control for selecting a single <option> from the list of options. <select multiple name="drawfs" id="drawfs"> <option>grumpy</option> <option>happy</option> <option>sleepy</option> <option>bashful</option> <option>sneezy</option> <option>dopey</option> <option>doc</option> </select> when multipl...
...ut without. when the form is submitted,had we used method="get" each selected file's name would have been added to url parameters as?uploads=img1.jpg&uploads=img2.svg. however, since we are sumbitting multipart form data, we much use post. see the <form> element and sending form data for more information. select the multiple attribute on the <select> element represents a control for selecting zero or more options from the list of options. otherwise, the <select> element represents a control for selecting a single <option> from the list of options. the control generally has a different appearance based on the presence of the multiple attribute, with most browsers displaying a scrolling list box instead of a single line dropdown when the attribute is present. <form method="get" action="#"> ...
<input type="email"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › email
an enter a list of multiple e-mail addresses, separated by commas and, optionally, whitespace characters. see allowing multiple e-mail addresses for an example, or html attribute: multiple for more details. note: normally, if you specify the required attribute, the user must enter a valid e-mail address for the field to be considered valid. however, if you add the multiple attribute, a list of zero e-mail addresses (an empty string, or one which is entirely whitespace) is a valid value. in other words, the user does not have to enter even one e-mail address when multiple is specified, regardless of the value of required. pattern the pattern attribute, when specified, is a regular expression that the input's value must match in order for the value to pass constraint validation. it must be...
...lue can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or wider than the specified number of characters, depending on the characters and the font (font settings in use). this does not set a limit on how many characters the user can enter into the field. it only specifies approximately how...
...re to aid you in solving the problem. examples here we have an email input with the id emailaddress which is allowed to be up to a maximum of 256 characters long. the input box itself is physically 64 characters wide, and displays the text user@example.gov as a placeholder anytime the field is empty. in addition, by using the multiple attribute, the box is configured to allow the user to enter zero or more e-mail addresses, separated by commas, as described in allowing multiple e-mail addresses. as a final touch, the list attribute contains the id of a <datalist> whose <option>s specify a set of suggested values the user can choose from. as an added touch, the <label> element is used to establish a label for the email entry box, with its for attribute referencing the emailaddress id of the...
Memory Management - JavaScript
script objects and also contain function scopes (or the global lexical scope). reference-counting garbage collection this is the most naive garbage collection algorithm. this algorithm reduces the problem from determining whether or not an object is still needed to determining if an object still has any other objects referencing it. an object is said to be "garbage", or collectible if there are zero references pointing to it. example var x = { a: { b: 2 } }; // 2 objects are created. one is referenced by the other as one of its properties. // the other is referenced by virtue of being assigned to the 'x' variable. // obviously, none can be garbage-collected. var y = x; // the 'y' variable is the second thing that has a reference to the object. x = 1; // now, the ob...
...e object. x = 1; // now, the object that was originally in 'x' has a unique reference // embodied by the 'y' variable. var z = y.a; // reference to 'a' property of the object. // this object now has 2 references: one as a property, // the other as the 'z' variable. y = 'mozilla'; // the object that was originally in 'x' has now zero // references to it. it can be garbage-collected. // however its 'a' property is still referenced by // the 'z' variable, so it cannot be freed. z = null; // the 'a' property of the object originally in x // has zero references to it. it can be garbage collected. limitation: circular references there is a limitation...
..., the root is the global object. periodically, the garbage collector will start from these roots, find all objects that are referenced from these roots, then all objects referenced from these, etc. starting from the roots, the garbage collector will thus find all reachable objects and collect all non-reachable objects. this algorithm is an improvement over the previous one since an object having zero references is effectively unreachable. the opposite does not hold true as we have seen with circular references. as of 2012, all modern browsers ship a mark-and-sweep garbage-collector. all improvements made in the field of javascript garbage collection (generational/incremental/concurrent/parallel garbage collection) over the last few years are implementation improvements of this algorithm, but...
Warning: 08/09 is not a legal ECMA-262 octal constant - JavaScript
"08 (or 09) is not a legal ecma-262 octal constant" occurs when 08 or 09 number literals are used. they can't be interpreted as an octal number. message warning: syntaxerror: 08 is not a legal ecma-262 octal constant. warning: syntaxerror: 09 is not a legal ecma-262 octal constant. error type warning. javascript execution won't be halted. ...
...th a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the number is interpreted as an octal number. because this is not the case with 08 and 09, javascript warns about it. note that octal literals and octal escape sequences are deprecated and will present an additional deprecation warning. with ecmascript 6 and later, the syntax uses a leading zero followed by a lowercase or uppercase latin letter "o" (0o or 0o). see the page about lexical grammar for more information. ...
...ascript 6 and later, the syntax uses a leading zero followed by a lowercase or uppercase latin letter "o" (0o or 0o). see the page about lexical grammar for more information. ...
Map - JavaScript
the map object holds key-value pairs and remembers the original insertion order of the keys. any value (both objects and primitive values) may be used as either a key or a value. description a map object iterates its elements in insertion order — a for...of loop returns an array of [key, value] for each iteration. key equality key equality is based on the samevaluezero algorithm. nan is considered the same as nan (even though nan !== nan) and all other values are considered equal according to the semantics of the === operator. in the current ecmascript specification, -0 and +0 are considered equal, although this was not so in earlier drafts. see "value equality for -0 and 0" in the browser compatibility table for details. objects vs. maps object is similar to map—both let you s...
...ery nan is not equal to itself (nan !== nan is true), the following example works because nans are indistinguishable from each other: let mymap = new map() mymap.set(nan, 'not a number') mymap.get(nan) // "not a number" let othernan = number('foo') mymap.get(othernan) // "not a number" iterating map with for..of maps can be iterated using a for..of loop: let mymap = new map() mymap.set(0, 'zero') mymap.set(1, 'one') for (let [key, value] of mymap) { console.log(key + ' = ' + value) } // 0 = zero // 1 = one for (let key of mymap.keys()) { console.log(key) } // 0 // 1 for (let value of mymap.values()) { console.log(value) } // zero // one for (let [key, value] of mymap.entries()) { console.log(key + ' = ' + value) } // 0 = zero // 1 = one iterating map with foreach() maps c...
...t key of mymap.keys()) { console.log(key) } // 0 // 1 for (let value of mymap.values()) { console.log(value) } // zero // one for (let [key, value] of mymap.entries()) { console.log(key + ' = ' + value) } // 0 = zero // 1 = one iterating map with foreach() maps can be iterated using the foreach() method: mymap.foreach(function(value, key) { console.log(key + ' = ' + value) }) // 0 = zero // 1 = one relation with array objects let kvarray = [['key1', 'value1'], ['key2', 'value2']] // use the regular map constructor to transform a 2d key-value array into a map let mymap = new map(kvarray) mymap.get('key1') // returns "value1" // use array.from() to transform a map into a 2d key-value array console.log(array.from(mymap)) // will show you exactly the same array as kvarray // a...
Iteration protocols - JavaScript
th a default iteration behavior, such as array or map, while other types (such as object) are not. ...
...therefore inside of the function, the this keyword can be used to access the properties of the iterable object, to decide what to provide during the iteration. ...
... function, each entry can be provided by using yield. the iterator protocol the iterator protocol defines a standard way to produce a sequence of values (either finite or infinite), and potentially a return value when all values have been generated. an object is an iterator when it implements a next() method with the following semantics: property value next() a zero-argument function that returns an object with at least the following two properties: done (boolean) has the value false if the iterator was able to produce the next value in the sequence. (this is equivalent to not specifying the done property altogether.) has the value true if the iterator has completed its sequence. in this case, value optionally specifies the return valu...
Strict mode - JavaScript
undesirable (it might hide a typo, for example), so in strict mode duplicate argument names are a syntax error: function sum(a, a, c) { // !!! syntax error 'use strict'; return a + a + c; // wrong if this code ran } sixth, a strict mode in ecmascript 5 forbids octal syntax. ...
... if this code ran } sixth, a strict mode in ecmascript 5 forbids octal syntax. the octal syntax isn't part of ecmascript 5, but it's supported in all browsers by prefixing the octal number with a zero: 0644 === 420 and "\045" === "%". in ecmascript 2015 octal number is supported by prefixing a number with "0o". i.e. ...
...t it's supported in all browsers by prefixing the octal number with a zero: 0644 === 420 and "\045" === "%". in ecmascript 2015 octal number is supported by prefixing a number with "0o". i.e. var a = 0o10; // es2015: octal novice developers sometimes believe a leading zero prefix has no semantic meaning, so they use it as an alignment device — but this changes the number's meaning! a leading zero syntax for the octals is rarely useful and can be mistakenly used, so strict mode makes it a syntax error: 'use strict'; var sum = 015 + // !!! syntax error 197 + 142; var sumwithoctal = 0o10 + 8; console.log(sumwithoctal); // 16 seventh, strict mode in ecmascript 2015 forbids setting properties on primitive values. without strict mode, setting properties is simply ignored...
clip-rule - SVG: Scalable Vector Graphics
ied on the referencing element, not on the object defining the clipping shape: <g> <clippath id="myclip"> <path d="..." /> </clippath> <rect clip-path="url(#myclip)" clip-rule="evenodd" ... /> </g> as a presentation attribute, it also can be used as a property directly inside a css stylesheet usage context categories presentation attribute value nonzero | evenodd | inherit animatable yes normative document svg 1.1 (2nd edition) nonzero see description of fill-rule property. evenodd see description of fill-rule property. example <svg width="100" viewbox="0 0 100 90" xmlns="http://www.w3.org/2000/svg" version="1.1"> <!-- define star path --> <defs> <path d="m50,0 21,90 98,35 2,35 79,90z" id="star" /> ...
... graphical elements » browser compatibility the compatibility table on this page is gen...
... graphical elements » browser compatibility the compatibility table on this page is generated from structured data. if you'd like to contribute to the data, please che...
kernelUnitLength - SVG: Scalable Vector Graphics
primitiveunits attribute) between successive columns and rows, respectively, in the kernelmatrix. by specifying value(s) for kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is not specified, the default value is one pixel in the offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. if a negative or zero value is specified the default value will be used instead. value <number-optional-number> default value pixel in offscreen bitmap animatable yes <number-optional-number> the first number is the x value. the second number is the y value. if the x value is not specified, it defaults to the same value as x. fediffuselighting for the <fediffuselightin...
...s) for kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is not specified, the x and y values represent very small deltas relative to a given position, which might be implemented in some cases as one pixel in the intermediate image offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. if a negative or zero value is specified the default value will be used instead. value <number-optional-number> default value pixel in offscreen bitmap animatable yes fespecularlighting for the <fespecularlighting>, kernelunitlength indicates the intended distance in current filter units (i.e., units as determined by the value of attribute primitiveunits) for the x and y ...
...s) for kernelunitlength, the kernel becomes defined in a scalable, abstract coordinate system. if the attribute is not specified, the x and y values represent very small deltas relative to a given position, which might be implemented in some cases as one pixel in the intermediate image offscreen bitmap, which is a pixel-based coordinate system, and thus potentially not scalable. if a negative or zero value is specified the default value will be used instead. value <number-optional-number> default value pixel in offscreen bitmap animatable yes specifications specification status comment filter effects module level 1the definition of 'kernelunitlength for <fespecularlighting>' in that specification. working draft m...
Localization - Archive of obsolete content
e: info: hello! info: bonjour ! note that because you can't require() modules in content scripts, you can't yet reference localized strings from content scripts. plurals the l10n module supports plural forms. different languages have different rules for the formation of plurals. ...
......
Forms related code snippets - Archive of obsolete content
style.zindex = nzindex++; otable.style.position = "absolute"; otable.style.left = otarget.offsetleft + "px"; otable.style.top = (otarget.offsettop + otarget.offsetheight) + "px"; otarget.parentnode.insertbefore(otable, otarget); }; ainstances.push(this); } datepicker.prototype.writedays = function () { const nendblanks = (this.current.getday() + bzeroismonday * 6) % 7, nend = amonthlengths[this.current.getmonth()] + nendblanks, ntotal = nend + ((7 - nend % 7) % 7); var otd, otr; if (this.otbody) { this.container.removechild(this.otbody); } this.otbody = document.createelement("tbody"); for (var nday, oday, niter = 0; niter < ntotal; niter++) { if (niter % 7 === 0) { otr = document.createelem...
...addeventlistener("load", buildcalendars, false) : window.attachevent ? attacheve...
Block and Line Layout Cheat Sheet - Archive of obsolete content
ion ns_frame_is_special nsblockframe mflags these flags are the private flags that are meaningful to block frames. ns_block_shrink_wrap causes the block to "shrink-wrap" around its content. this means the block will determine its children's width and make its content area that wide. finally, it will add padding and border to determine the final width. is this where the "tending towards zero width" stuff comes in? ns_block_no_auto_margins ns_block_margin_root indicates that this is a frame from which child margins can be calculated. the absence of this flag implies that child margin calculations should ignore the frame and look further up the parent chain. used in nsblockreflowcontext::computecollapsedtopmargin(). this flag causes the nsblockreflowstate's constructor to set the b...
...te constructor when the "white-space" style of the block frame is pre or nowrap. it is cleared, otherwise. brs_istopmarginroot this flag is set in the nsblockreflowstate constructor when reflowing a "block margin root" frame (i.e., a frame with the ns_block_margin_root flag set, for which margins apply by default). the flag is also set when reflowing a frame whose computed top border padding is zero. (why?) brs_isbottommarginroot this flag is set in the nsblockreflowstate constructor when reflowing a "block margin root" frame (i.e., a frame with the ns_block_margin_root flag set, for which margins apply by default). the flag is also set when reflowing a frame whose computed bottom border padding is zero. (why?) brs_applytopmargin this flag is set if the top margin should be considered wh...
Using microformats - Archive of obsolete content
roformats in a document that match specified criteria. var nummicroformats = microformats.count(name, rootelement, options); parameters name the name of the microformat to count. rootelement required. the dom element at which to begin the search. if you want to search the entire document, specify content.document. options optional. if provided, this is a javascript object that contains zero or more of the following flags: recurseexternalframes if true, child frames are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're left out. the default is false. debug specify true if debug mode is in use; otherwise, specify false. the default is false. return value an integer value indicating the number of microformats...
...rmats found that match specified criteria. var microformatsarray = microformats.get(name, rootelement, options, targetarray); parameters name the name of the microformat to find. rootelement required. the dom element at which to begin the search. if you want to search the entire document, specify content.document. options optional. if provided, this is a javascript object that contains zero or more of the following flags: recurseexternalframes if true, child frames that reference external content are included in the search. the default is true. showhidden if true, hidden microformats are added; otherwise they're left out. the default is false. debug specify true if debug mode is in use; otherwise, specify false. the default is false. targetarray optional. if provided...
Monitoring downloads - Archive of obsolete content
loadmanager.download_downloading, the file has begun to download. the adownload object is an nsidownload object. in that case, we create a new row in our database for the new file by opening the database and building a replace into sqlite command. the first three rows are set to the values of the source uri, file size, and start time fields from the download object. the remaining rows are set to zeroes since that's not information we have at the moment. if the download's state indicates that the download is finished, canceled, or failed, we call our logtransfercompleted routine to update the log to indicate that state change. that code looks like this: logtransfercompleted: function(adownload) { var endtime = new date(); // current time is the end time // issue th...
...lled, one row of the results is fetched. after that, the list row object is created, and each entry in the search result is fetched and inserted into the appropriate list cell. the interesting bits to take away from this: mozistoragestatement has several data getter routines for fetching search results, including getstring(), getdouble(), and getint64(). these methods take as a parameter the zero-based index number of the column whose value you wish to retrieve. note that the start time is being divided by 1000 before we create a javascript date object from it. that's to adjust the value from the granularity stored in the database to that expected by javascript. to right-justify the numeric columns, we set the appropriate cells' style attribute to text-align:right. exercises for the r...
LIR - Archive of obsolete content
13 line void source line number for debug symbols 14 comment void a comment shown, on its own line, in lir dumps 15 not in use load 16 not in use 17 ldc2i integer load char and sign-extend to an int 18 lds2i integer load short and sign-extend to an int 19 lduc2ui integer load unsigned char and zero-extend to an unsigned int 20 ldus2ui integer load unsigned short and zero-extend to an unsigned int 21 ldi integer load int 22 ldq quad 64 bit load quad 23 ldd double load double 24 ldf2d double load float and extend to a double store 25 sti2c void store int truncated to char 26 sti2s void store int ...
...nkey briefly but is always demoted to a lir_modl or converted to a function call before nanojit has to do anything serious with it. ...
Treehydra Manual - Archive of obsolete content
ocking in a simple mutex api in test/esp_lock.js. abstract interpretation is a big topic, which is not yet fully documented here. for now, here is an explanation of some of the terminology that is often confusing: concrete value. a value in the programming language being analyzed. e.g., (int) 3. abstract value. a value used in the analysis script that represents a set of concrete values. e.g., nonzero. in esp, these are user-defined. concrete state. a memory state in the programming language being analyzed. in other words, a mapping from program variables to concrete values. abstract state. conceptually, this is an object used in the analysis that represents a set of concrete states. in the esp library, these are esp.state objects. bottom. this is a special abstract state the represents the ...
... this is a special abstract state that represents all possible states. top is also used to name a special abstract value that represents all possible concrete values. thus, top means the analysis has no information about that value or state. meet. meet is a relation on abstract values used to filter states at conditional statements. for example, if the current abstract value of a variable x is nonzero, and the analysis goes inside an if statement with the condition x == 1, then in the new abstract value of x will be nonzero meet 1. esp uses a user-defined meet function supplied to the analysis constructor that should return the intersection of two abstract values. it is also acceptable for meet to return a value that contains the intersection--this may cause the analysis to have more false pos...
Using Breakpoints in Venkman - Archive of obsolete content
is can be useful to try out additional code, on the fly. stop regardless of result causes venkman to stop execution after executing the breakpoint script, allowing you to inspect program state. stop if result is true effectively makes this a conditional breakpoint. if the breakpoint script returns a true value (it doesn't have to strictly be a boolean true, any non-null, non-empty string, non-zero, non-undefined, and non-false value will do), execution will continue normally. if, on the other hand, the script returns a false value, venkman will stop execution at that point. early return from caller with result will cause the function that the breakpoint is set in to return the value of the breakpoint script as its result, immediatley after the breakpoint script completes. the pass exce...
... be logged to the interactive session. the //@jsd_break comment will insert a breakpoint which is set to execute the script that follows and stop if the result is true. the //@jsd_eval command will insert a breakpoint which is set to execute the script that follows without stopping and without logging the result. these meta comments can be used to insert debug-only code in your scripts with zero impact on production code. to enable meta comments in a script, select "scan for meta comments" from the context menu of the file in the loaded scripts view. when you add a meta comment, a normal breakpoint is created. you can change or delete this breakpoint just as you would a breakpoint created by hand. resources venkman introduction—previous article on venkman. venkman's home page on ...
getLastError - Archive of obsolete content
this method allows you to defer checking for error codes each time you call addfile or adddirectory until the last addfile or adddirectory call. the getlasterror method does not return errors from methods that return objects, such as getfolder. ...
...this method allows you to defer checking for error codes each time you call addfile or adddirectory until the last addfile or adddirectory call. the getlasterror method does not return errors from methods that return objects, such as getfolder. ...
resetError - Archive of obsolete content
reseterror resets a saved error code to zero. method of install object syntax void reseterror (); parameters none. returns nothing. description the reseterror method resets any saved error code to zero. see getlasterror for additional information. ...
... reseterror resets a saved error code to zero. method of install object syntax void reseterror (); parameters none. returns nothing. description the reseterror method resets any saved error code to zero. see getlasterror for additional information. ...
Methods - Archive of obsolete content
n and schedules it for later execution. gestalt retrieves information about the operating environment. (mac os only) getcomponentfolder returns an object representing the directory in which a component is installed. getfolder returns an object representing a directory, for use with the addfile method. getlasterror returns the most recent non-zero error code. getwinprofile constructs an object for working with a windows .ini file. getwinregistry constructs an object for working with the windows registry. initinstall initializes installation for the given software and version. loadresources returns an object whose properties are localized strings loaded from the specified property file...
... add a comment line to the install log. patch applies a set of differences between two versions. performinstall finalizes the installation of the software. refreshplugins refreshes the list of plug-ins registered for the browser. registerchrome registers chrome with the chrome registry. reseterror resets a saved error code to zero. setpackagefolder sets the default package folder that is saved with the root node. ...
Reading from Files - Archive of obsolete content
characters below 256, if you expect to use the data as text. while(stream.available()) output += stream.readstring(20); although this can be a suitable means of reading binary data, usually you will want to retrieve the data with some additional methods that are more useful. the following methods are available: readboolean will read a single byte from a stream and return false if the byte is zero and true if the byte has a non-zero value. read8 will read a single byte and return it. the 8 in the method name indicates that 8 bits of data are being read. read16 will read two bytes from the stream and interpret them as an integer. this method will return the value as a number. read32 will read four bytes and return this as a single 32-bit integer. readfloat will read four bytes and interpret...
... file with their higher bits first. for both the read16 and read32 methods, the values are always interpreted as unsigned values. if you want the sign bit to be interpreted such that negative values can be read, you can use a simple calculation to convert the value: var val = stream.read16(); if (val > 0x7fff) val = ~(0x10000 - val - 1); sometimes, a file will contain bytes that have the value zero. you can use the read8 method to read these. the read and readstring methods may not be suitable for this due to zero-values. an additional method that is useful here is the readbytearray method. this method is used to read a number of bytes into an array. unlike with the other reading methods that read a string, the readbytearray method returns an array where each element is a byte of data from ...
Writing to Files - Archive of obsolete content
t used, the data is written at the beginning of the file, overwriting what is already there. nocreate if used, don't create a new file if it does not already exist. in this case, an error will occur if the file does not exist, which you can capture using a try-catch block. if this flag is not used, a new file will be created. in either case, if the file already exists, it will be truncated to zero length. notruncate if used, don't truncate an existing file when opening it for writing. instead, just overwrite the existing content. if the new data being written is shorter than the existing data, the existing data will remain in the areas where no new data was written. if this flag is not used, the file is truncated before being written to. the flags are designed such that the most commo...
...two bytes to the stream. write32 will write four bytes. writefloat will write a floating point value in four bytes. writedouble will write a floating point value in eight bytes. in this example, the write16 method is used to write the value 1000 in two bytes. the write32 method performs a similar operation except that the value 1000 is written using four bytes, padding the unused bits with zeroes. stream.write16(1000); stream.write32(1000); all values are read in big endian form, which means that integers are stored in the file with their higher bits first. for the write16 and write32 methods, the values are always interpreted as unsigned values. if you want to write a negative value, use the following calculation first to convert the value: function writenegative(val) { if (val > 0x...
removeTransientNotifications - Archive of obsolete content
...
... ...
Textbox (XPFE autocomplete) - Archive of obsolete content
that the textbox allows to be entered. maxrows type: integer the number of rows to show in the results list at a time. a scrollbar will appear so the user can scroll through the remaining items. minresultsforpopup obsolete since gecko 1.9.1 type: integer the minimum number of results that must be returned for the popup to be displayed. the default value is 1. a zero value will always open the popup unless the textbox is empty. this can be used to display additional items that are not autocomplete results. as of gecko 1.9.1, this attribute is now always specified in lower case. minresultsforpopup new in thunderbird 3requires seamonkey 2.0 type: integer the minimum number of results that must be returned for the popup to be displayed.
...n be used to display additional items that are not autocomplete results. as of gecko 1.9.1, this attribute is now always specified in lower case. minresultsforpopup new in thunderbird 3requires seamonkey 2.0 type: integer the minimum number of results that must be returned for the popup to be displayed. the default value is 1. new in thunderbird 3requires seamonkey 2.0 a zero value will always open the popup. this can be used to display additional items that are not autocomplete results. nomatch type: boolean this attribute will be set to true if the last search resulted in no matches. overview an onchange attribute is an event listener to the object for the event change. a change event is fired in different ways for different xul input elements as list...
listbox - Archive of obsolete content
hat it is. if the item is already visible, no scrolling occurs. getindexoffirstvisiblerow() return type: integer returns the index of the first displayed row. note that this is not the same as the first row -- if the displayed items have been scrolled down, this function will retrieve the index of the first row that the user can see. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. getnumberofvisiblerows() return type: integer returns the number of rows that are currently visible to the user. getrowcount() return type: integer returns the total...
...owcount() return type: integer returns the total number of rows in the element, regardless of how many rows are displayed. getselecteditem( index ) return type: element when multiple items are selected, you can retrieve each selected item using this method. the argument index specifies the index in the list of the selected items, not the row number of the item. the item index is zero-based, thus this example will return the first selected item: getselecteditem(0). insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. invertselection() return type: no return value reverses the selected state of all items. select...
richlistbox - Archive of obsolete content
t it is. if the item is already visible, no scrolling occurs. getindexoffirstvisiblerow() return type: integer returns the index of the first displayed row. note that this is not the same as the first row -- if the displayed items have been scrolled down, this function will retrieve the index of the first row that the user can see. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. getnumberofvisiblerows() return type: integer returns the number of rows that are currently visible to the user. getrowcount() return type: integer returns the to...
...wcount() return type: integer returns the total number of rows in the element, regardless of how many rows are displayed. getselecteditem( index ) return type: element when multiple items are selected, you can retrieve each selected item using this method. the argument index specifies the index in the list of the selected items, not the row number of the item. the item index is zero-based, thus this example will return the first selected item: getselecteditem(0). insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new item element is returned. invertselection() return type: no return value reverses the selected state of all items. sele...
GetObject - Archive of obsolete content
ws store apps or later. use the getobject function to access an automation object from a file. assign the object returned by getobject to the object variable. for example: var cadobject; cadobject = getobject("c:\\cad\\schema.cad"); when this code is executed, the application associated with the specified pathname is started, and the object in the specified file is activated. if pathname is a zero-length string (""), getobject returns a new object instance of the specified type. if the pathnameargument is omitted, getobject returns a currently active object of the specified type. if no object of the specified type exists, an error occurs. some applications allow you to activate part of a file. to do so, add an exclamation point (!) to the end of the file name and follow it with a string t...
... file already loaded. if there is no current instance, and you don't want the object started with a file loaded, use the activexobject object. if an object has registered itself as a single-instance object, only one instance of the object is created, no matter how many times activexobject is executed. with a single-instance object, getobject always returns the same instance when called with the zero-length string ("") syntax, and it causes an error if the pathname argument is omitted. requirements supported in the following document modes: quirks, internet explorer 6 standards, internet explorer 7 standards, and internet explorer 8 standards. ...
Extra lives - Game development
ev...
... events you have probably noticed the add() and addonce() method calls in the above two code blocks and wondered how they differ. ...
Gecko FAQ - Gecko Redirect 1
as robert o'callahan notes in bug 25707, "full html4/css1 compliance can't mean '100% bug free'. if it does, no-one will ever ship a fully compliant browser." because web pages can be arbitrarily long and complex and have arbitrarily deeply nested markup, it will always be possible to construct web pages that do not d...
...as robert o'callahan notes in bug 25707, "full html4/css1 compliance can't mean '100% bug free'. if it does, no-one will ever ship a fully compliant browser." because web pages can be arbitrarily long and complex and have arbitrarily deeply nested markup, it will always be possible to construct web pages that do not display in a given browser the...
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
r a reference to a function defined elsewhere. a number representing the time interval in milliseconds (1000 miliseconds equals 1 second) to wait before executing the code. if you specify a value of 0 (or simply omit the value), the function will run as soon as possible. (see the note below on why it runs "as soon as possible" and not "immediately".) more on why you might want to do this later. zero or more values that represent any parameters you want to pass to the function when it is run. note: the specified amount of time (or the delay) is not the guaranteed time to execution, but rather the minimum time to execution. the callbacks you pass to these functions cannot run until the stack on the main thread is empty. as a consequence, code like settimeout(fn, 0) will execute as soon as...
...u can work out each of these. how would you calculate them? have a think about it: the number of seconds in an hour is 3600. the number of minutes will be the amount of seconds left over when all of the hours have been removed, divided by 60. the number of seconds will be the amount of seconds left over when all of the minutes have been removed. you'll want to include a leading zero on your display values if the amount is less than 10, so it looks more like a traditional clock/watch. to pause the stopwatch, you'll want to clear the interval. to reset it, you'll want to set the counter back to 0, clear the interval, and then immediately update the display. you probably ought to disable the start button after pressing it once, and enable it again after you've stopped/reset i...
Deployment and next steps - Learn web development
e common problems. svelte questions on stackoverflow: questions with the svelte tag at so. svelte reddit community: svelte community discussion and content rating site at reddit. svelte dev community: a collection of svelte-related technical articles and tutorials from the dev.to community. finito congratulations! you have completed the svelte tutorial. in the previous articles we went from zero knowledge about svelte to building and deploying a complete application. we learned about svelte philosophy and what sets it apart from other front-end frameworks. we saw how to add dynamic behavior to our web site, how to organize our app in components and different ways to share information among them. we took advantage of the svelte reactivity system and learned how to avoid common pitfal...
...ced concepts and techniques to interact with dom elements and to programmatically extend html element capabilities using the use directive. then we saw how to use stores to work with a central data repository, and we created our own custom store to persist our application's data to web storage. we also took a look at svelte's typescript support. in this article we've learned about a couple of zero-fuss options to deploy our app in production and seen how to setup a basic pipeline to deploy our app to gitlab on every commit. then we provided you with a list of svelte resources to go further with your svelte learning. congratulations! after completing this series of tutorials you should have a strong base from which to start developing professional web applications with svelte. previou...
Building SpiderMonkey with UBSan
m & clang. 2. save the following bash script, fixing llvm_root to point to your installation. #! /bin/sh if [ -z $1 ] ; then echo "usage: $0 <dirname>" elif [ -d $1 ] ; then echo "directory $1 already exists" else autoconf2.13 autoconf213 mkdir $1 cd $1 llvm_root="$home/llvm" sanflag="-fsanitize=undefined -fno-sanitize=alignment,float-cast-overflow,float-divide-by-zero,vptr -dxmalloc=myxmalloc" \ cc="$llvm_root/build/release+asserts/bin/clang" \ cxx="$llvm_root/build/release+asserts/bin/clang++" \ cflags="$sanflag" \ cxxflags="$sanflag" \ moz_llvm_hacks=1 \ ../configure --enable-debug --disable-optimize make -j 8 fi 3. use the script to compile spidermonkey. this enables all the cheap undefined behavior checks other than: ...
...ble-optimize make -j 8 fi 3. use the script to compile spidermonkey. this enables all the cheap undefined behavior checks other than: alignment, which hits known bugs in spidermonkey, and is more implementation-defined (slow on x86 / crash on arm) than undefined behavior float-cast-overflow, which hits known bugs in spidermonkey, and isn't exploited by today's compilers float-divide-by-zero, which jesse doesn't think is actually undefined behavior (aside from the question of whether cpu overflow flags are set) vptr, a check that requires rtti, which is disabled by default in spidermonkey 4. when you hit a bug and want a stack trace, run under gdb with a breakpoint at the end of __ubsan::diag::~diag(). the stack trace should show a function such as __ubsan_handle_load_invalid_val...
How to Report a Hung Firefox
this won't produce useful results on a regular release/beta build. instead of crashing firefox, more advanced develo...
...this won't produce useful results on a regular release/beta build. instead of crashing firefox, more advanced developers who know how to use a debugger can try attaching t...
Download
y becomes true. contenttype string the mime type of the download, for example "text/plain", or null if the mime type is not available. this property may be populated or changed while the download is in progress, using the mime type provided by the server. currentbytes read only number number of bytes currently transferred. this value starts at zero, and may be updated regardless of the value of hasprogress. note: you shouldn't rely on this property being equal to totalbytes to determine whether the download is completed. you should use the individual state properties instead, since this value may not be updated after the last piece of data is transferred. error read only downloaderror when the download fails, this ...
...anceled download is restarted. succeeded read only boolean this propery is true if the download has been completed successfully. target read only downloadtarget target of this download. totalbytes read only number when hasprogress is true, this indicates the total number of bytes to be transferred before the download finishes; this value can be zero if the file is empty. note: this property's value may not match the actual final size of the downloaded file if the download is encoded during the network transfer. you can use the downloadtarget.size property to get the actual size of the completely-downloaded file once the download has succeeded. when hasprogress is false, this property is always zero. trytokeeppartialdat...
PerfMeasurement.jsm
sx (bug 583323) as well, and we welcome patches for other operating systems. method overview static bool canmeasuresomething(); void reset(); void start(); void stop(); member fields recorded data variables these variables provide access to the recorded data. any measurable event that was not being recorded has a value of -1 (that is, 0xffffffffffffffff). note: these values are all zeroed (or set to -1, for events not being measured) when you initialize the perfmeasurement object, then they are not zeroed again unless you explicitly call the reset() method. this lets you accumulate measurements over multiple passes through code that you want to analyze. variable type description cpu_cycles uint64 the number of cpu cycles elapsed. instructions uint64 the number of instr...
...easurement object configured to record the specified event types. methods canmeasuresomething() indicates whether or not the platform on which your code is running supports this code module. static bool canmeasuresomething(); parameters none. return value if even one of the event types can be recorded, this will return true. otherwise, it returns false. reset() resets all the enabled counters to zero. void reset(); parameters none. start() starts measuring the performance indicators that were specified when the perfmeasurement object was created. void start(); parameters none. stop() stops measuring performance data. for each enabled counter, the number of measured events of that type that occurred are added to the appropriate visible variable. void stop(); parameters none. ...
source-editor.jsm
may be, for example, "\n", "\r", or "\r\n". string getlinedelimiter(); parameters none. return value a string containing the character or characters that delineate lines of text. getlineend returns the character offset of the character after the specified line number in the text. number getlineend( number alineindex, [optional] boolean aincludedelimiter ); parameters alineindex zero-based offset to the line number to which to return the end offset. aincludedelimiter optional if false, the returned offset is to the first character of the end-of-line delimiter if the specified line (this is the default). if true, the returned offset is the offset to the first character of the following line. return value the offset to the last character in the specified line, or -1 if the...
...e default). if true, the returned offset is the offset to the first character of the following line. return value the offset to the last character in the specified line, or -1 if the specified line number is out of range. getlinestart returns the character offset of the first character of the specified line in the text. number getlinestart( number alineindex ); parameters alineindex zero-based offset to the line number to which to return the end offset. return value the offset to the first character in the specified line, or -1 if the specified line number is out of range. getmode() returns the current syntax highlighting mode for the document's contents. string getmode(); parameters none. return value a string indicating the type of file being edited, as previously se...
Mozilla Web Developer FAQ
first and last child element in table cells. therefore, the default margins for paragraphs apply even with markup such as <td><p>foo</p></td>. often the content of a cell in a table of tabular data does not constitute a paragraph. in that case, the easy solution is not to mark the contents of the cell as a paragraph. when the paragraph markup is called for but the default margins are unwanted, zero margins can be suggested using css. my style sheet doesn’t work! why? here’s the check list: does the html document validate? styling misnested markup may cause strange effects. the <link> and <style> elements should be inside the <head> element. does the css style sheet pass the syntax check? the css error handling rules require erroneous parts to be ignored rather than fix...
...style sheet doesn’t work! why? here’s the check list: does the html document validate? styling misnested markup may cause strange effects. the <link> and <style> elements should be inside the <head> element. does the css style sheet pass the syntax check? the css error handling rules require erroneous parts to be ignored rather than fixed by guessing. lengths other than zero should be followed by a proper unit without a space between the number and the unit (eg. 1.2em). the character to use between the property name and the value is the colon—not the equal sign. html markup, such as <style>, does not belong in .css files. font-face is not a real css property. the property is font-family and @font-face is an at-rule. if @import is used, it should be the ...
Refcount tracing and balancing
.log post-processing step 3: building the balance tree now that you've the log file fully prepared, you can build a balance tree. this process takes all the stack addref() and release() stack traces and munges them into a call graph. each node in the graph represents a call site. each call site has a balance factor, which is positive if more addref()s than release()es have happened at the site, zero if the number of addref()s and release()es are equal, and negative if more release()es than addref()s have happened at the site. to build the balance tree, run tools/rb/make-tree.pl, specifying the object of interest. for example: perl -w tools/rb/make-tree.pl --object 0x00253ab0 < my-leak.log this will build an indented tree that looks something like this (except probably a lot larger and le...
...ier. check for leaks from smart pointers. if the leak comes from a smart pointer that is logged in the xpcom_mem_comptr_log, then find-comptr-leakers.pl will find the exact stack for you, and you don't have to look at trees. ignore balanced trees. the make-tree.pl script accepts an option --ignore-balanced, which tells it not to bother printing out the children of a node whose balance factor is zero. this can help remove some of the clutter from an otherwise noisy tree. ignore matched releases from smart pointers. if you've checked (see above) that the leak wasn't from a smart pointer, you can ignore the references that came from smart pointers (where we can use the pointer identity of the smart pointer to match the addref and the release). this requires using an xpcom_mem_refcnt_log and an...
tools/power/rapl
name has five characters. the total power is the sum of the package power and the ram power. the package estimate is divided into three parts: cores, gpu, and "other". "other" is computed as the package power minus the cores power and gpu power. if the processor does not support gpu or ram estimates then " n/a " will be printed in the relevant column instead of a number, and it will contribute zero to the total. once sampling is finished — either because the user interrupted it, or because the requested number of samples has been taken — the following summary data is shown: 10 samples taken over a period of 10.000 seconds distribution of 'total' values: mean = 8.85 w std dev = 3.50 w 0th percentile = 5.17 w (min) 5th percentile = 5.17 w 25th percentile ...
... options -i --sample-interval. the length of each sample in milliseconds. defaults to 1000. a warning is given if you set it below 50 because that is likely to lead to inaccurate estimates. -n --sample-count. the number of samples to take. the default is 0, which is interpreted as "unlimited". combining with powermetrics on mac, you can use the mach power command to r...
PR_EnterMonitor
unction has the following parameter: mon a reference to an existing structure of type prmonitor. description when the calling thread returns, it will have acquired the monitor's lock. attempts to acquire the lock for a monitor that is held by some other thread will result in the caller blocking. the operation is neither timed nor interruptible. ...
...red the monitor's lock. attempts to acquire the lock for a monitor that is held by some other thread will result in the caller blocking. the operation is neither timed nor interruptible. if the monitor's entry count is greater than zero and the calling thread is recognized as the holder of the lock, pr_entermonitor increments the entry count by one and returns. if the entry count is greater than zero and the calling thread is not recognized as the holder of the lock, the thread is blocked until the entry count reaches zero. when the entry count reaches zero (or if it is already zero), the entry count is incremented by one and the calling thread is recorded as the lock's holder. ...
PR_Poll
detects when i/o is ready for a set of socket file descriptors. syntax #include <prio.h> print32 pr_poll( prpolldesc *pds, printn npds, printervaltime timeout); parameters the function has the following parameters: pds a pointer to the first element of an array of prpolldesc structures. npds the number of elements in the pds array. if this parameter is zero, pr_poll is equivalent to pr_sleep with a timeout. timeout amount of time the call will block waiting for i/o to become ready. if this time expires without any i/o becoming ready, pr_poll returns zero. returns the function returns one of these values: if successful, the function returns a positive number indicating the number of prpolldesc structures in pds that have events. the value 0 indicates the function tim...
... structures in pds that have events. the value 0 indicates the function timed out. the value -1 indicates the function failed. the reason for the failure can be obtained by calling pr_geterror. description this function returns as soon as i/o is ready on one or more of the underlying socket objects. a count of the number of ready descriptors is returned unless a timeout occurs, in which case zero is returned. the in_flags field of the prpolldesc data structure should be set to the i/o events (readable, writable, exception, or some combination) that the caller is interested in. on successful return, the out_flags field of the prpolldesc data structure is set to indicate what kind of i/o is ready on the respective descriptor. pr_poll uses the out_flags fields as scratch variables during th...
PR_dtoa
string, using the method specified by mode. possible modes are: 0 shortest string that yields d when read in and rounded to nearest. 1 like 0, but with steele & white stopping rule. for example, with ieee 754 arithmetic, mode 0 gives 1e23 whereas mode 1 gives 9.999999999999999e22. 2 max(1, ndigits) significant digits. this gives a return value similar to that of ecvt, except that trailing zeros are suppressed. 3 through ndigits past the decimal point. this gives a return value similar to that from fcvt, except that trailing zeros are suppressed, and ndigits can be negative. 4,5,8,9 same as modes 2 and 3, but usingleft to right digit generation. 6-9 same as modes 2 and 3, but do not try fast floating-point estimate (if applicable). all others treated as mode 2. upon return, th...
...eturn value similar to that from fcvt, except that trailing zeros are suppressed, and ndigits can be negative. 4,5,8,9 same as modes 2 and 3, but usingleft to right digit generation. 6-9 same as modes 2 and 3, but do not try fast floating-point estimate (if applicable). all others treated as mode 2. upon return, the buffer specified by buf and bufsz contains the converted string. trailing zeros are suppressed. sufficient space is allocated to the return value to hold the suppressed trailing zeros. if the input parameter d is+infinity,-infinity ornan, *decpt is set to 9999. ...
NSS 3.45 release notes
only relevant for clients that might have copied the unit test code verb...
...only relevant for clients that might have copied the unit test code verbatim bug 1550022 - ensure nssutil3 gets built on android bug 1528174 - chacha20poly1305 should no longer ...
PKCS #11 Module Specs
lid flags are: nomoddb don't open secmod.db and try to supply the strings. the mod db function is not through standard pkcs #11 interfaces. readonly databases should be opened read only. nocertdb don't try to open a certificate database. nokeydb don't try to open a key database. forceopen don't fail to initialize the token if the databases could not be opened. passwordrequired zero length passwords are not acceptable (valid only if there is a keydb). optimizespace allocate smaller hash tables and lock tables. when this flag is not specified, softoken will allocate large tables to prevent lock contention. tokens configure 'tokens' by hand. the tokens parameter specifies a space separated list of slotids, each of which specify their own set of parameters affecting that ...
...n minimum password length for this token. flags comma separated list of flag values, parsed case-insensitive. valid flags are: readonly databases should be opened read only. nocertdb don't try to open a certificate database. nokeydb don't try to open a key database. forceopen don't fail to initialize the token if the databases could not be opened. passwordrequired zero length passwords are not acceptable (valid only if there is a keydb). optimizespace allocate smaller hash tables and lock tables. when this flag is not specified, softoken will allocate large tables to prevent lock contention. examples: ...
Rhino JavaScript compiler
t a java class implementing the java interface java-intf-name should be generated from the incoming javascript source file. each global function in the source file is made a method of the generated class, implementing any methods in the interface by the same name. -debug -g specifies that debug information should be generated. may not be combined with optimization at an optlevel greater than zero. -main-method-class classname specify the class name used for main method implementation. the class must have a method matching public static void main(script sc, string[] args). -nosource does not save the source in the class file. functions and scripts compiled this way cannot be decompiled. this option can be used to avoid distributing source or simply to save space in the resulting cl...
...stributing source or simply to save space in the resulting class file. -o outputfile writes the class file to outputfile, which should end in .class and must be a writable filename. -d outputdirectory writes the class file to outputdirectory. -opt optlevel optimizes at level optlevel, which must be an integer between -1 and 9. see optimization for more details. if optlevel is greater than zero, -debug may not be specified. -package packagename specifies the package to generate the class into. the string packagename must be composed of valid identifier characters optionally separated by periods. -version versionnumber specifies the language version to compile with. the string versionnumber must be one of 100, 110, 120, 130, 140, 150, 160, or 170. see javascript language versions...
64-bit Compatibility
sptrdiff, jsuptrdiff, jssize, jsuword, jsword (let's not use these, kthx) the following types are 32-bit on 32-bit platforms. for all intents and purposes they are also 32-bit on 64-bit platforms: intn, uintn jsintn, jsuintn, jsbool general problems with pointers when performing bitwise operations on pointer values, make sure that both operands are 64-bit. the compiler can implicitly sign or zero extend operands with unintended side effects. for example, consider this code: #define pointer_tagbits 3 static inline uintptr_t unmaskpointer(uintptr_t v) { return v & ~pointer_tagbits; } the value 3 will be inverted to 0xfffffffc, then zero-extended to 0x00000000fffffffc - a subtle and nasty bug, assuming it is unintended. the best way to fix this is to make types explicit, such as: co...
... i64 qeq - quge i64, i64 i32 qcall n/a i64 extending or truncating native integers sometimes it is necessary to reduce a native integer to a 32-bit integer (for example, array or string lengths in tracemonkey) or extend a 32-bit integer to a native integer. there are three such opcodes: lir_i2q - sign-extends a 32-bit integer to a 64-bit integer. lir_u2q - zero-extends a 32-bit integer to a 64-bit integer. lir_qlo - truncates a 64-bit integer to its lower 32 bits. there are three helper functions in lirwriter: ins_i2p() - on 32-bit platforms, does nothing. on 64-bit platforms, performs a lir_i2q. ins_u2p() - on 32-bit platforms, does nothing. on 64-bit platforms, performs a lir_u2q. ins_p2i() - on 32-bit platforms, does nothing. on 64-bit platform...
JSErrorReport
a user-defined error-reporting mechanism. syntax jserrorreport(); properties name type description filename const char * indicates the source file or url that produced the error condition. if null, the error is local to the script in the current html page. lineno unsigned line number in the source that caused the error. column unsigned zero-based column index in line in the source that caused the error. ismuted bool the web platform allows scripts to be loaded from arbitrary cross-origin sources. this allows an attack by which a malicious website loads a sensitive file (say, a bank statement) cross-origin (using the user's cookies), and sniffs the generated syntax errors (via a window.onerror handler) for juicy m...
...the line that caused the error, minus the trailing newline character. tokenptr const char * pointer to the error token in *linebuf. uclinebuf const char16_t * unicode line buffer. this is the buffer that contains the original data. uctokenptr const char16_t * pointer to the error token in *uclinebuf. flags unsigned the logical or of zero or more of the following flags: jsreport_warning this "error" is really only a warning. it will not cause the current operation to fail. jsreport_exception an exception is being raised. a jserrorreporter might choose to ignore a jserrorreport that has this flag set, since the exception may be caught and handled by javascript code. j...
JSPrincipals
incipals object is like a java codesource. jsprincipals could be passed into the js engine through the js_newglobalobject function. jsprincipals has refcount property that is the reference count. this is used for memory management. each time an object is referenced, refcount must be increased by one. each time an object is dereferenced, refcount must be decremented by one. when refcount reaches zero, the principals are no longer in use and are destroyed. use the js_holdprincipals to increment refcount, and use js_dropprincipals to decrement refcount. obsolete. the data content of a principals object is defined by the application, which creates instances of jsprincipals, initializes their refcount fields to 1, and passes them into the engine through the js_...forprincipals functions. some ...
...to the function that retrieves the principals for this object or script. globalprivilegesenabled is a flag that indicates whether principals are enabled globally. refcount is the reference count. this is used for memory management. each time an object is referenced, refcount must be increased by one. each time an object is dereferenced, refcount must be decremented by one. when refcount reaches zero, the principals are no longer in use and are destroyed. use the jsprincipals_hold macro to increment refcount, and use jsprincipals_drop to decrement refcount. see also mxr id search for jsprincipals js_newglobalobject js_holdprincipals js_dropprincipals bug 715417 - removed getprincipalarray and globalprivilegesenabled bug 728250 - added dump method, removed codebase, destroy, and subs...
JS_ConstructObject
new object's prototype, or null. parent jsobject * the object to serve as the new object's parent, or null. argc unsigned int (only in js_constructobjectwitharguments) the number of arguments to pass to the constructor. argv jsval * (only in js_constructobjectwitharguments) the array of arguments to pass to the constructor. this may be null if argc is zero. otherwise, the first argc elements of this array must be populated with valid jsval values. the caller does not need to ensure that the array elements are rooted. description js_constructobject creates a new object of the specified class, with the specified prototype and parent, then invokes a constructor function to initialize the new object. cx is a pointer to a context associated with...
... to initialize the new object. cx is a pointer to a context associated with the runtime in which to create the new object. clasp is a pointer to the class of object to create. proto and parent may specify objects to be used as the new object's prototype and parent. if either is null, the engine tries to find reasonable defaults. js_constructobjectwitharguments is the same but additionally passes zero or more arguments to the constructor. neither of these functions is quite like the javascript new keyword. for details on how we find the appropriate constructor and default prototype, see js_newobject: choosing a default prototype. roughly speaking, we use parent or cx to find a global object, and then find clasp's constructor in that global object. if parent is null, the engine chooses an o...
JS_DefineConstDoubles
ext * the context in which to define the new properties. requires request. in a js_threadsafe build, the caller must be in a request on this jscontext. obj jsobject * object for which to create new properties. cds jsconstdoublespec * pointer to an array of jsconstdoublespec records containing property names and values to create. the last array element must contain zero-valued members. cis jsconstintegerspec * pointer to an array of jsconstintegerspec records containing property names and values to create. the last array element must contain zero-valued members. description js_defineconstdoubles creates one or more properties for a specified object, obj, where each property consists of a double value. js_defineconstintegers creates one or mo...
..._permanent | jsprop_readonly. cds and cis are pointers to the first element of an array of jsconstdoublespec/jsconstintegerspec structures. each array element defines a single property name and property value to create. the name field of the last element of the array must contain 0. js_defineconstdoubles/js_defineconstintegers create one property for each element in the array what contains a non-zero name field. on success, js_defineconstdoubles/js_defineconstintegers returns true, indicating it has created all properties listed in the array. otherwise it returns false. see also mxr id search for js_defineconstdoubles mxr id search for js_defineconstintegers jsconstdoublespec jsconstintegerspec js_defineelement js_defineproperties js_defineproperty js_definepropertywithtinyid bug 10...
JS_DefineFunction
6_t * name to assign to the function. id js::handle&lt;jsid&gt; a pointer to jsid for name to assign to the function. added in spidermonkey 17 call jsnative the native c/c++ function to be wrapped by the new function. nargs unsigned number of arguments that are passed to the function when it is called. flags unsigned the logical or of zero or more property attributes. description js_definefunction exposes a c/c++ function to scripts by defining a new method on an existing javascript object. it creates the new function object as though by calling js_newfunction, then makes it a method of obj as though by calling js_defineproperty. js_defineucfunction is the unicode version of the function. name is the name of the property to c...
...e new function. it also becomes the name property of the new function object and can be accessed using js_getfunctionid. call is a pointer to the c/c++ function that is to be exposed to javascript. nargs indicates the number of arguments the function expects to receive. this becomes the new function object's length property and can be accessed using js_getfunctionarity. flags is the logical or of zero or more property attributes, which apply to the new property. on success, js_definefunction and js_defineucfunction return a pointer to the new function. on error or exception, they return null. see also mxr id search for js_definefunction mxr id search for js_defineucfunction mxr id search for js_definefunctionbyid js_callfunctionname js_callfunctionvalue js_compilefunction js_definefunc...
JS_DefineFunctions
properties, dontdefinelateproperties }; name description defineallproperties define all properties regardless of their flags. onlydefinelateproperties define only properties which have a jsprop_define_late flag. dontdefinelateproperties define only properties which have no jsprop_define_late flag. description js_definefunctions creates zero or more functions and makes them properties (methods) of a specified object, obj, as if by calling js_definefunction repeatedly. fs is a pointer to the first element of an array of jsfunctionspec records. this array is usually defined as a static global, with each record initialized using js_fs or js_fn. each array element defines a single function: its name, the native c/c++ implementation, the...
...tic global, with each record initialized using js_fs or js_fn. each array element defines a single function: its name, the native c/c++ implementation, the number of javascript arguments the function expects, and any property attributes. the last element of the array must contain 0 values. (the macro js_fs_end can be used for the last element.) js_definefunctions creates one function for each non-zero element in the array. propertydefinitionbehavior is used to select if properties with jsprop_define_late flag should be defined on the object. normal jsapi consumers probably always want defineallproperties here. on success, js_definefunctions returns true. on error or exception, it stops defining functions and returns false. see also mxr id search for js_definefunctions js_callfunctionnam...
JS_SetOptions
raged since it could be removed at any time. try to avoid using it. enables and disables options on a jscontext, replacing all previously set options. syntax uint32 js_setoptions(jscontext *cx, uint32 options); name type description cx jscontext * a context on which to set options. options uint32 the new set of options. this is the logical or of zero or more flags described below. description js_setoptions sets the option flags of a given js context cx. this function returns a uint32 value containing the previous values of the flags. to turn individual options on or off, use js_setoptions with js_getoptions: // turn on warnings for dubious practices js_setoptions(cx, js_getoptions(cx) | jsoption_extra_warnings); // turn off those extra...
...2 value containing the previous values of the flags. to turn individual options on or off, use js_setoptions with js_getoptions: // turn on warnings for dubious practices js_setoptions(cx, js_getoptions(cx) | jsoption_extra_warnings); // turn off those extra warnings js_setoptions(cx, js_getoptions(cx) & ~jsoption_extra_warnings); the options parameter and the return value are the logical or of zero or more constants from the following table: option description jsoption_extra_warnings warn on dubious practice. mxr id search for jsoption_extra_warnings jsoption_werror convert warnings to errors. mxr id search for jsoption_werror jsoption_varobjfix make js_evaluatescript() use the last obj...
JSAPI reference
see js::value for their modern replacements. jsval_is_null obsolete since jsapi 32 jsval_is_void obsolete since jsapi 32 jsval_is_boolean obsolete since jsapi 32 jsval_is_number obsolete since jsapi 32 jsval...
...sidarray class js::autoidarray added in spidermonkey 17 js_idarraylength added in spidermonkey 17 js_idarrayget added in spidermonkey 17 js_destroyidarray js_getobjectid obsolete since jsapi 31 jsid constants: jsid_void jsid_voidhandle added in spidermonkey 31 jsid_empty jsid_emptyhandle added in spidermonkey 31 function for checking and converting the type of a jsid: jsid_is_zero jsid_is_void jsid_is_empty jsid_is_string jsid_to_string interned_string_to_jsid added in spidermonkey 38 jsid_to_flat_string added in spidermonkey 17 jsid_is_int jsid_to_int int_fits_in_jsid int_to_jsid jsid_is_symbol added in spidermonkey 38 jsid_to_symbol added in spidermonkey 38 symbol_to_jsid added in spidermonkey 38 jsid_is_gcthing jsid_to_gcthing jsid_is_object obsolete ...
Animated PNG graphics
Mozilla › Tech › APNG
sions specified by the width and height parameters of the png 'ihdr' chunk. conceptually, each frame is constructed in the output buffer before being composited onto the canvas. the contents of the output buffer are available to the decoder. the corners of the output buffer are mapped to the corners of the canvas. fully transparent black means red, green, blue and alpha components are all set to zero. for purposes of chunk descriptions, an unsigned int shall be a 32-bit unsigned integer in network byte order limited to the range 0 to (2^32)-1; an unsigned short shall be a 16-bit unsigned integer in network byte order with the range 0 to (2^16)-1; and a byte shall be an 8-bit unsigned integer with the range 0 to (2^8)-1. error handling apng is designed to allow incremental display of frames...
...m_frames indicates the total number of frames in the animation. this must equal the number of 'fctl' chunks. 0 is not a valid value. 1 is a valid value for a single-frame apng. if this value does not equal the actual number of frames it should be treated as an error. num_plays indicates the number of times that this animation should play; if it is 0, the animation should play indefinitely. if nonzero, the animation should come to rest on the final frame at the end of the last play. 'fctl': the frame control chunk the 'fctl' chunk is an ancillary chunk as defined in the png specification. it must appear before the 'idat' or 'fdat' chunks of the frame to which it applies, specifically: for the default image, if a 'fctl' chunk is present it must appear before the first 'idat' chunk. positio...
IAccessibleText
at was just inserted. return value s_false if there is nothing to return, [out] value is null. s_ok. nselections() returns the number of active non-contiguous selections. [propget] hresult nselections( [out] long nselections ); parameters nselections missing description return value s_ok. offsetatpoint() returns the text() position for the specified screen position. given a point return the zero-based index of the character under that point. the same functionality could be achieved by using the bounding boxes for each character as returned by characterextents(). the method offsetatpoint, however, can be implemented more efficiently. [propget] hresult offsetatpoint( [in] long x, [in] long y, [in] enum ia2coordinatetype coordtype, [out] long offset ); parameters x the position's ...
...ssed. s_ok. text() returns the substring between the two given indices. the substring starts with the character at startoffset (inclusive) and up to the character at endoffset (exclusive), if startoffset is less or equal endoffste. if endoffset is lower than startoffset, the result is the same as a call with the two arguments being exchanged. the whole text can be requested by passing the indices zero and ncharacters(). if both indices have the same value, an empty string is returned. [propget] hresult text( [in] long startoffset, [in] long endoffset, [out] bstr text ); parameters startoffset index of the first character to include in the returned string. the valid range is 0..length. endoffset index of the last character to exclude in the returned string. the valid range is 0..length.
DoAction
exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ns_error_invalid_arg indicates that the given index is our of range. ...
...exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ns_error_invalid_arg indicates that the given index is our of range. ...
nsIAccessible
ible. groupposition this method returns grouping information. used for tree items, list items, tab panel labels, radio buttons, etc. also used for collectons of non-text objects. getchildatpoint this method returns an accessible child which contains the coordinate at (x, y) in screen pixels. getchildat this method returns nth accessible child using zero-based index or last child if index than less than zero. getaccessibletoright this method returns an accessible node geometrically to the right of this one. getaccessibletoleft this method returns an accessible node geometrically to the left of this one. getaccessibleabove this method returns an accessible node geometrically above this one. ...
...e current selection. extendselection this method extends the current selection from its current accessible anchor node to this accessible. takeselection this method selects this accessible node only. takefocus this method focuses this accessible node. getactionname this method retrieves the name of the accessible action at the given zero-based index. getactiondescription this method retrieves the description of the accessible action at the given zero-based index. doaction this method performs the accessible action at the given zero-based index. action number 0 is the default action. attributes parent parent node in accessible tree. nextsibling next sibling in accessi...
nsIDOMProgressEvent
e transfer is known. read only. loaded unsigned long long the number of bytes transferred since the beginning of the operation. this doesn't include headers and other overhead, but only the content itself. read only. total unsigned long long the total number of bytes of content that will be transferred during the operation. if the total size is unknown, this value is zero. read only. methods initprogressevent() deprecated since gecko 22.0 this method has been removed from use in javascript in gecko 22.0. use the regular constructor to construct a synthetic progressevent. it still is usable from native c++ code. initializes the progress event object. void initprogressevent( in domstring typearg, in boolean canbubblearg, in boolean cancelablearg,...
...d event will bubble. cancelablearg specifies whether or not the created event can be canceled. lengthcomputablearg if the size of the data to be transferred is known, this should be true. otherwise, specify false. loadedarg the number of bytes already transferred. must be a non-negative value. totalarg the total number of bytes to be transferred. if lengthcomputable is false, this must be zero. see also using xmlhttprequest xmlhttprequest nsixmlhttprequesteventtarget nsixmlhttprequest ...
nsIDOMWindowUtils
0x0002 used for aoptions of sendwheelevent(). if this is set, the synthesized wheel event emulates momentum scroll event. wheel_event_customized_by_user_prefs 0x0004 used for aoptions of sendwheelevent(). if this is set, the synthesized wheel event emulates an event whose delta values are computed from user prefs in widget level. ...
... sendwheelevent(). if this is set, the synthesized wheel event emulates an event whose delta values are computed from user prefs in widget level. ...
nsIScriptError2
w void initwithwindowid(in wstring message, in wstring sourcename, in wstring sourceline, in pruint32 linenumber, in pruint32 columnnumber, in pruint32 flags, in string category, in unsigned long long innerwindowid); attributes attribute type description innerwindowid unsigned long long the inner window id with which the error is associated. this is zero if the error was initialized by calling nsiscripterror.init() instead of initwithwindowid(). read only. outerwindowid unsigned long long the window id with which the error is associated. this is zero if the error was initialized by calling nsiscripterror.init() instead of initwithwindowid(). read only. timestamp long long elapsed time, in milliseconds, from a platfo...
...read only. ...
nsITextInputProcessor
key_keep_key_location_standard 0x00000008 one of akeyflags. the location attribute value of dispatching keyboard events is computed automatically if the attribute isn't initialized or initialized with 0. for the latter case, you may not want textinputprocessor to compute location attribute value. in this case, you can suppress the computation with this flag. if this is specified with non-zero location attribute value, this causes throwing an exception since it doesn't make sense. key_keep_keycode_zero 0x00000010 one of akeyflags. the keycode attribute value of dispatching printable keyboard events is computed from key value automatically if the attribute isn't initialized or initialized with 0. for the latter case, you may not want textinputprocessor to compute keycode ...
... key_dont_dispatch_modifier_key_event 0x00000020 one of akeyflags. textinputprocessor manages modifier state with every modifier key events. ...
nsIWebProgressListener
status); void onstatuschange(in nsiwebprogress awebprogress, in nsirequest arequest, in nsresult astatus, in wstring amessage); constants state transition flags these flags indicate the various states that requests may transition through as they are being loaded. these flags are mutually exclusive. for any given request, onstatechange() is called once with the state_start flag, zero or more times with the state_transferring flag or once with the state_redirecting flag, and then finally once with the state_stop flag. note: for document requests, a second state_stop is generated (see the description of state_is_window for more details). constant value description state_start 0x00000001 this flag indicates the start of a request. this flag is set...
...n. arequest the associated nsirequest. this may be null in some cases. alocation the uri of the location that is being loaded. aflags this is a value which explains the situation or the reason why the location has changed. optional from gecko 11 onprogresschange() notification that the progress has changed for one of the requests associated with awebprogress. progress totals are reset to zero when all requests in awebprogress complete (corresponding to onstatechange() being called with astateflags including the state_stop and state_is_window flags). note: if any progress value is unknown, or if its value would exceed the maximum value of type long, then its value is replaced with -1. note: if the object also implements nsiwebprogresslistener2 and the caller knows about that interfac...
Performance
at these requirements make some operations, especially commits, very slow. for each commit, sqlite does two disk syncs among many other file operations (see the "atomic commit" section of http://www.sqlite.org/php2004/slides-all.html for more information on how this works). these disk syncs are very slow and limit the speed of a commit to the rotational speed of the mechanical disk. vacuuming and zero-fill sqlite has a vacuum command to compress unused space from the database. sqlite works like a memory manager or a file system. when data is deleted, the associated bytes are marked as free but are not removed from the file. this means that the file will not shrink, and some data may still be visible in the file. the way to work around this is to run the vacuum command to remove this space. vac...
...ed history items. users have the expectation that deleting items in their history will remove the traces of that from the database. as a result, mozilla enables the sqlite_secure_delete preprocessor flag in db/sqlite3/src/makefile.in. this flag causes deleted items to be filled with 0s on disk. this eliminates the need to vacuum except to reclaim disk space, and makes many operations much faster. zero-filling can have significant performance overhead in some situations. for example, the history service used to delete many database items at shutdown when expiring old history items. this operation is not necessarily slow, but writing 0s to disk in an "aci" database is still slow. this made shutdown very slow because the asyncio thread would block shutdown (bug 328598). shutdown times of more tha...
AbstractRange - Web APIs
font-family="consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">abstractrange</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties collapsed read only a boolean value which is true if the range is collapsed. a collapsed range is one whose start position and end position are the same, resulting in a zero-character-long range. endcontainer read only the dom node in which the end of the range, as specified by the endoffset property, is located. endoffset read only an integer value indicating the offset, in characters, from the beginning of the node's contents to the beginning of the range represented by the range object. this value must be less than the length of the endcontainer node. start...
...ample creates a new range, rng, and sets its starting point to the third child node of the first element whose class is elementclass. the end point is set to be the middle of the first child of the span, and then the range is used to copy the contents of the range. ranges and the hierarchy of the dom in order to define a range of characters within a document in a way that is able to span across zero or more node boundaries, and which is as resilient as possible to changes to the dom, you can't simply specify the offset to the first and last characters in the html. there are a few good reasons for that. first, after your page is loaded, the browser simply isn't thinking in terms of html. once it's been loaded, the page is a tree of dom node objects, so you need to specify the beginning and e...
CanvasRenderingContext2D.clip() - Web APIs
ath. it doesn't work with shape primitives drawn directly to the canvas, such as fillrect(). instead, you'd have to use rect() to add a rectangular shape to the path before calling clip(). syntax void ctx.clip([fillrule]); void ctx.clip(path [, fillrule]); parameters fillrule the algorithm by which to determine if a point is inside or outside the clipping region. possible values: "nonzero": the non-zero winding rule. default rule. "evenodd": the even-odd winding rule. path a path2d path to use as the clipping region. examples a simple clipping region this example uses the clip() method to create a clipping region according to the shape of a circular arc. two rectangles are then drawn; only those parts within the clipping region are rendered. html <canvas id="canvas">...
...tx.fillstyle = 'blue'; ctx.fillrect(0, 0, canvas.width, canvas.height); ctx.fillstyle = 'orange'; ctx.fillrect(0, 0, 100, 100); result specifying a path and a fillrule this example saves two rectangles to a path2d object, which is then made the current clipping region using the clip() method. the "evenodd" rule creates a hole where the clipping rectangles intersect; by default (with the "nonzero" rule), there would be no hole. html <canvas id="canvas"></canvas> javascript const canvas = document.getelementbyid('canvas'); const ctx = canvas.getcontext('2d'); // create clipping path let region = new path2d(); region.rect(80, 10, 20, 130); region.rect(40, 50, 100, 50); ctx.clip(region, "evenodd"); // draw stuff that gets clipped ctx.fillstyle = 'blue'; ctx.fillrect(0, 0, canvas.width...
DataTransferItemList.remove() - Web APIs
if the index doesn't correspond to an existing item in the list, the list is left unchanged. return value undefined. exceptions invalidstateerror the drag data store is not in read/write mode, so the item can't be removed. example this example shows the use of the remove() method. ...
...if the index doesn't correspond to an existing item in the list, the list is left unchanged. return value undefined. exceptions invalidstateerror the drag data store is not in read/write mode, so the item can't be removed. example this example shows the use of the remove() method. ...
HTMLImageElement.x - Web APIs
from there, we can get the <img> element itself from the cell by calling queryselector() on the htmltablecellelement representing that cell. finally, we ...
... from there, we can get the <img> element itself from the cell by calling queryselector() on the htmltablecellelement representing that cell. ...
HTMLImageElement.y - Web APIs
from there, we can get the <img> element itself from the cell by calling queryselector() on the htmltablecellelement representing that cell. finally, we ...
... from there, we can get the <img> element itself from the cell by calling queryselector() on the htmltablecellelement representing that cell. ...
Option() - Web APIs
s = document.getelementbyid('s'); var options = [four, five, six]; options.foreach(function(element,key) { s[key] = new option(element,key); }); append options with different parameters /* assuming we have the following html <select id="s"> <option>first</option> <option>second</option> <option>third</option> </select> */ var s = document.getelementbyid('s'); var options = [ 'zero', 'one', 'two' ]; options.foreach(function(element, key) { if (element == 'zero') { s[s.options.length] = new option(element, s.options.length, false, false); } if (element == 'one') { s[s.options.length] = new option(element, s.options.length, true, false); // will add the "selected" attribute } if (element == 'two') { s[s.options.length] = new option(element, s.options.le...
... recommendation ...
HTMLTableRowElement - Web APIs
ated value indicating how the content of the cell must be vertically aligned. it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablerowelement.deletecell() removes the cell at the given position in the row. ...
...returns a reference to a htmltablecellelement [en-us]. specifications specification status comment html living standardthe definition of 'htmltablerowelement' in that specification. ...
HTMLTableSectionElement - Web APIs
lue indicating how the content of the cell must be vertically aligned. it reflects the valign attribute and can have one of the following values: "top", "middle", "bottom", or "baseline". methods inherits methods from its parent, htmlelement. htmltablesectionelement.deleterow() removes the cell at the given position in the section. ...
... specifications specification status comment html living standardthe definition of 'htmltablesectionelement' in that specification. ...
Using microtasks in JavaScript with queueMicrotask() - Web APIs
a call to queuemicrotask() used to schedule a microtask to run. this call is bracketed by calls to log(), a custom function that simply outputs text to the screen. log("before enqueueing the microtask"); queuemicrotask(() => { log("the microtask has run.") }); log("after enqueueing the microtask"); result timeout and microtask example in this example, a timeout is scheduled to fire after zero milliseconds (or "as soon as possible"). this demonstrates the difference between what "as soon as possible" means when scheduling a new task (such as by using settimeout()) versus using a microtask. html <pre id="log"> </pre> javascript the code below is used to log the output. let logelem = document.getelementbyid("log"); let log = s => logelem.innerhtml += s + "<br>"; in the followin...
...re> javascript the code below is used to log the output. let logelem = document.getelementbyid("log"); let log = s => logelem.innerhtml += s + "<br>"; in the following code, we see a call to queuemicrotask() used to schedule a microtask to run. this call is bracketed by calls to log(), a custom function that simply outputs text to the screen. the code below schedules a timeout to occur in zero milliseconds, then enqueues a microtask. this is bracketed by calls to log() to output additional messages. let callback = () => log("regular timeout callback has run"); let urgentcallback = () => log("*** oh noes! an urgent callback has run!"); log("main program started"); settimeout(callback, 0); queuemicrotask(urgentcallback); log("main program exiting"); result note that the output log...
Intersection Observer API - Web APIs
e ancestor of the target. defaults to the browser viewport if not specified or if null. rootmargin margin around the root. can have values similar to the css margin property, e.g. "10px 20px 30px 40px" (top, right, bottom, left). the values can be percentages. this set of values serves to grow or shrink each side of the root element's bounding box before computing intersections. defaults to all zeros. threshold either a single number or an array of numbers which indicate at what percentage of the target's visibility the observer's callback should be executed. if you only want to detect when visibility passes the 50% mark, you can use a value of 0.5. if you want the callback to run every time visibility passes another 25%, you would specify the array [0, 0.25, 0.5, 0.75, 1]. the default is ...
...et currently intersects the root by looking at the entry's isintersecting property; if its value is true, the target is at least partially intersecting the root element or document. this lets you determine whether the entry represents a transition from the elements intersecting to no longer intersecting or a transition from not intersecting to intersecting. note that it's possible to have a non-zero intersection rectangle, which can happen if the intersection is exactly along the boundary between the two or the area of boundingclientrect is zero. this state of the target and root sharing a boundary line is not considered enough to be considered transitioning into an intersecting state. to get a feeling for how thresholds work, try scrolling the box below around. each colored box within it d...
performance.clearResourceTimings() - Web APIs
to set the size of the browser's performance data buffer, use the performance.setresourcetimingbuffersize() method. note: this feature is available in web workers. syntax performance.clearresourcetimings(); arguments void return value none this method has no return value. ...
...performance data buffer cleared"); else console.log("... performance data buffer not cleared!"); } specifications specification status comment resource timing level 1the definition of 'clearresourcetimings()' in that specification. candidate recommendation initial d...
Range.setEnd() - Web APIs
Web › API › Range › setEnd
ge to be located at the given offset into the specified node x.setting the end point above (higher in the document) than the start point will result in a collapsed range with the start and end points both set to the specified end position. syntax range.setend(endnode, endoffset); parameters endnode the node inside which the range should end. endoffset an integer greater than or equal to zero representing the offset for the end of the range from the start of endnode. return value undefined. exceptions exceptions are thrown as domexception objects of the following types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located inside a doctype node. indexsizeerror the value specified by endoffset is either greater than or equal ...
...e range from the start of endnode. return value undefined. exceptions exceptions are thrown as domexception objects of the following types: invalidnodetypeerror the node specified by endnode is a doctype node; range endpoints cannot be located inside a doctype node. indexsizeerror the value specified by endoffset is either greater than or equal to the length of the node or is less than zero. 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. for other node types, endoffset is the number of child nodes between the start of the endnode. example const range = document.createrange(); const endnode = document.getelementsbytagname('p').item(3); const endoffset = endnode.childnodes.length; ...
Using the Resource Timing API - Web APIs
console.log ("= print performance.clearresourcetimings()"); var supported = typeof performance.clearresourcetimings == "function"; if (supported) { console.log("... performance.clearresourcetimings() = supported"); performance.clearresourcetimings(); } else { console.log("... performance.clearresourcetiming() = not supported"); return; } // getentries should now return zero var p = performance.getentriesbytype("resource"); if (p.length == 0) console.log("... performance data buffer cleared"); else console.log("... performance data buffer not cleared (still have `" + p.length + "` items"); } function set_resource_timing_buffer_size(n) { if (performance === undefined) { console.log("= performance.setresourcetimingbuffersize(): peformance not suppo...
...this requires the server providing the resource to send the timing-allow-origin http response header with a value specifying the origin or origins which are allowed to get the restricted timestamp values. the properties which are returned as 0 by default when loading a resource from a domain other than the one of the web page ...
SVGTransform - Web APIs
type unsigned short the type of the value as specified by one of the svg_transform_* constants defined on this interface. angle float a convenience attribute for svg_transform_rotate, svg_transform_skewx and svg_transform_skewy. it holds the angle that was specified. for svg_transform_matrix, svg_transform_translate and svg_transform_scale, angle will be zero. matrix svgmatrix the matrix that represents this transformation. the matrix object is live, meaning that any changes made to the svgtransform object are immediately reflected in the matrix object and vice versa. in case the matrix object is changed directly (i.e., without using the methods on the svgtransform interface itself) then the type of the svgtransform changes to svg_...
..._scale, a and d represent the scale amounts (b=0, c=0, e=0 and f=0). for svg_transform_skewx and svg_transform_skewy, a, b, c and d represent the matrix which will result in the given skew (e=0 and f=0). for svg_transform_rotate, a, b, c, d, e and f together represent the matrix which will result in the given rotation. when the rotation is around the center point (0, 0), e and f will be zero. methods name & arguments return description setmatrix(in svgmatrix matrix) void sets the transform type to svg_transform_matrix, with parameter matrix defining the new transformation. note that the values from the parameter matrix are copied. exceptions: a domexception with code no_modification_allowed_err is raised when att...
TextEncoder.prototype.encodeInto() - Web APIs
ation step multiply the remaining unconverted length by two instead of three. ...
... in that case, it makes sense not to implement the usual multiplying by two of the already written buffer length, because in such a case if a second reallocation happened, it would always overallocate compared to the original length times three.the above advice assumes that you don't need to allocate space for a zero terminator. that is, on the wasm side you are working with rust strings or a non-zero-terminating c++ class. if you are working with c++ std::string, even though the logical length is shown to you, you need to take the extra terminator byte into account when computing rounding up to allocator bucket size. see the next section about c strings. no zero-termination if the input string contains the character u+0000 in the input, encodeinto() will write a 0x00 byte in the output. enc...
Supporting both TouchEvent and MouseEvent - Web APIs
s a code snippet of the touchmove event handler calling preventdefault(). ...
...d, the standard indicates the following order is typical: for single input: touchstart zero or more touchmove events, depending on movement of the finger(s) touchend mousemove mousedown mouseup click if the touchstart, touchmove or touchend event is canceled during an interaction, no mouse or click events will be fired, and the resulting sequence of events would just be: touchstart zero or more touchmove events, depending on movement of the finger(s) touchend community touch events community group mail list w3c #touchevents irc channel related topics and resources touch events overview using touch events touch and mouse (together again for the first time) ...
UIEvent.detail - Web APIs
Web › API › UIEvent › detail
specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'uievent.detail' in that specification. ...
... specifications specification status comment document object model (dom) level 3 events specificationthe definition of 'uievent.detail' in that specification. ...
WebGLRenderingContext.blendFunc() - Web APIs
lendfunc() method of the webgl api defines which function is used for blending pixel arithmetic. syntax void gl.blendfunc(sfactor, dfactor); parameters sfactor a glenum specifying a multiplier for the source blending factors. the default value is gl.one. for possible values, see below. dfactor a glenum specifying a multiplier for the destination blending factors. the default value is gl.zero. for possible values, see below. return value none. exceptions if sfactor or dfactor is not one of the listed possible values, a gl.invalid_enum error is thrown. if a constant color and a constant alpha value are used together as source and destination factors, a gl.invalid_enum error is thrown. constants the following constants can be used for sfactor and dfactor. the formula for the...
... value are used together as source and destination factors, a gl.invalid_enum error is thrown. constants the following constants can be used for sfactor and dfactor. the formula for the blending color can be described like this: color(rgba) = (sourcecolor * sfactor) + (destinationcolor * dfactor). the rbga values are between 0 and 1. constant factor description gl.zero 0,0,0,0 multiplies all colors by 0. gl.one 1,1,1,1 multiplies all colors by 1. gl.src_color rs, gs, bs, as multiplies all colors by the source colors. gl.one_minus_src_color 1-rs, 1-gs, 1-bs, 1-as multiplies all colors by 1 minus each source color. gl.dst_color rd, gd, bd, ad multiplies all colors by the destination color. ...
WebGLRenderingContext.stencilOp() - Web APIs
he function to use when the stencil test passes, but the depth test fails. the default value is gl.keep. zpass a glenum specifying the function to use when both the stencil test and the depth test pass, or when the stencil test passes and there is no depth buffer or depth testing is disabled. the default value is gl.keep. return value none. constants gl.keep keeps the current value. ...
... gl.decr decrements the current stencil buffer value. clamps to 0. gl.decr_wrap decrements the current stencil buffer value. wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of 0. ...
WebGLRenderingContext.stencilOpSeparate() - Web APIs
he function to use when the stencil test passes, but the depth test fails. the default value is gl.keep. zpass a glenum specifying the function to use when both the stencil test and the depth test pass, or when the stencil test passes and there is no depth buffer or depth testing is disabled. the default value is gl.keep. return value none. constants gl.keep keeps the current value. ...
... gl.decr decrements the current stencil buffer value. clamps to 0. gl.decr_wrap decrements the current stencil buffer value. wraps stencil buffer value to the maximum representable unsigned value when decrementing a stencil buffer value of 0. ...
WebGL best practices - Web APIs
irements, getshaderprecisionformat() will tell you what the system supports. if highp float is available, gl_fragment_precision_high will be defined as 1. ...
... relative lowp 10-bit signed fixed (-2, 2) 2^-8 2^-8 absolute int think range highp int17 (-2^16, 2^16) mediump int11 (-2^10, 2^10) lowp int9 (-2^8, 2^8) *float24: sign bit, 7-bit for exponent, 16-bit for mantissa essl300 minimum requirements (webgl 2) float think range min above zero precision highp ieee float32 (-2^126, 2^127) 2^-126 2^-24 relative mediump ieee float16 (-2^14, 2^14) 2^-14 2^-10 relative lowp 10-bit signed fixed (-2, 2) 2^-8 2^-8 absolute (u)int think int range unsigned int range highp (u)int32 [-2^31, 2^31] [0, 2^32] mediump (u)int...
WebGL model view projection - Web APIs
tohomogeneous(point) let x = point[0]; let y = point[1]; let z = point[2]; return [x, y, z, 1]; } function homogeneoustocartesian(point) { let x = point[0]; let y = point[1]; let z = point[2]; let w = point[3]; return [x/w, y/w, z/w]; } as previously mentioned and shown in the functions above, the w component divides the x, y, and z components. when the w component is a non-zero real number then homogeneous coordinate easily translates back into a normal point in cartesian space. now what happens if the w component is zero? in javascript the value returned would be as follows. homogeneoustocartesian([10, 4, 5, 0]); this evaluates to: [infinity, infinity, infinity]. this homogeneous coordinate represents some point at infinity. this is a handy way to represent a ray s...
... a specific direction. in addition to a ray, it could also be thought of as a representation of a directional vector. if this homogeneous coordinate is multiplied against a matrix with a translation then the translation is effectively stripped out. when numbers are extremely large (or extremely small) on computers they begin to become less and less precise because there are only so many ones and zeros that are used to represent them. the more operations that are done on larger numbers, the more and more errors accumulate into the result. when dividing by w, this can effectively increase the precision of very large numbers by operating on two potentially smaller, less error-prone numbers. the final benefit of using homogeneous coordinates is that they fit very nicely for multiplying against 4...
WebSocket.bufferedAmount - Web APIs
syntax var bufferedamount = awebsocket.bufferedamount; value an unsigned long. ...
... syntax var bufferedamount = awebsocket.bufferedamount; value an unsigned long. ...
Writing a WebSocket server in C# - Web APIs
tcpclient client = server.accepttcpclient(); console.writeline("a client connected."); } } tcpclient methods: system.net.sockets.networkstream getstream() gets the stream which is the communication channel. both sides of the channel have reading and writing capability. properties: int available this property indicates how many bytes of data have been sent. the value is zero until networkstream.dataavailable is true. networkstream methods: write(byte[] buffer, int offset, int size) writes bytes from buffer, offset and size determine length of message. read(byte[] buffer, int offset, int size) reads bytes to buffer. offset and size determine the length of the message. let us extend our example. tcpclient client = server.accepttcpclient(); console.writel...
...as such: fin (bit 0) rsv1 (bit 1) rsv2 (bit 2) rsv3 (bit 3) opcode (bit 4:7) 1 0 0 0 0x1=0001 fin bit: this bit indicates whether the full message has been sent from the client. messages may be sent in frames, but for now we will keep things simple. rsv1, rsv2, rsv3: these bits must be 0 unless an extension is negotiated which supplies a nonzero value to them. opcode: these bits describe the type of message received. opcode 0x1 means this is a text message. full list of opcodes the second byte, which currently has a value of 131, is another bitfield that breaks down as such: mask (bit 0) payload length (bit 1:7) 1 0x83=0000011 mask bit: defines whether the "payload data" is masked. if set to 1, a...
Geometry and reference spaces in WebXR - Web APIs
origins are aligned when the space is first established. however, as changes in alignment accumulate over time the origin offset may change to compensate. the position of a point in space relative to the origin is determined by determining its distance along each of the three spatial axes shown in the diagram above. the space's origin is the point (0, 0, 0), at the center of the space and at the zero position along each axis. specifically, under the initial starting conditions, with the default orientation of the viewer upon the space: the x-axis extends horizontally from left to right away from the origin, with the x coordinate of +1.0 being located at the right edge of the world. negative values of x extend toward the left from the origin, reaching a value of -1.0 at the left edge of the...
...eference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the nati...
Inputs and input sources - Web APIs
esent, you can use it to identify and poll the buttons and axes available on the controller. while the gamepad record is defined by the gamepad api specification, it's not actually managed by the gamepad api, and doesn't function exactly the same way. see supporting advanced controllers and gamepads in webxr applications for more detailed information. profile strings each input source can have zero or more input profile name strings, found in the array profiles, each of which describes a preferred visual representation of the input source within the 3d world as well as how the input source functions. the use of these profiles is briefly described under input profiles below, and a more complete guide may be found in our article using webxr input profiles. transient input sources some devic...
...; }); the inputsourceschange event is also fired once when the session's creation callback first completes execution, so you can use it to fetch the input source list as soon as it's available at startup time. the event is delivered as an xrinputsourcechangeevent, which includes three properties of interest: session the xrsession for which the input sources have changed. added an array of zero or more xrinputsource objects indicating the input sources that have been newly added to the xr system. removed an array of zero or more xrinputsource objects indicating any input sources that have been removed from the xr system. identifying the input's profile each input source has a profiles property, which contains a live list of the webxr input profiles which apply to the input source, ...
Using IIR filters - Web APIs
look at the code to create an iir filter with the web audio api. setting our iirfilter co-efficients when creating an iir filter, we pass in the feedforward and feedback coefficients as options (coefficients is how we describe the values). both of these parameters are arrays, neither of which can be larger than 20 items. ...
... options (coefficients is how we describe the values). both of these parameters are arrays, neither of which can be larger than 20 items. when setting our coefficients, the feedforward values can't all be set to zero, otherwise nothing would be sent to the filter. something like this is acceptable: let feedforward = [0.00020298, 0.0004059599, 0.00020298]; our feedback values cannot start with zero, otherwise on the first pass nothing would be sent back: let feedbackward = [1.0126964558, -1.9991880801, 0.9873035442]; note: these values are calculated based on the lowpass filter specified in the filter characteristics of the web audio api specification. as this filter node gains more popularity we should be able to collate more coefficient values. using an iirfilter in an audio graph ...
Using Web Workers - Web APIs
st be hosted within the same origin as the parent page. also, the uris for subworkers are resolved relative to the parent worker's location rather than that of the owning page. this makes it easier for workers to keep track of where their dependencies are. importing scripts and libraries worker threads have access to a global function, importscripts(), which lets them import scripts. ...
...e consistent in queryableworker and the worker. passing data by transferring ownership (transferable objects) google chrome 17+ and firefox 18+ contain an additional way to pass certain types of objects (transferable objects, that is objects implementing the transferable interface) to or from a worker with high performance. transferable objects are transferred from one context to another with a zero-copy operation, which results in a vast performance improvement when sending large data sets. think of it as pass-by-reference if you're from the c/c++ world. however, unlike pass-by-reference, the 'version' from the calling context is no longer available once transferred. its ownership is transferred to the new context. for example, when transferring an arraybuffer from your main app to a worker...
XRInputSourcesChangeEvent.added - Web APIs
examples the example below creates a handler for the inputsourceschange event that processes the lists of added and removed from the webxr system. it looks for new and removed devices whose targetraymode is tracked-pointer. ...
... examples the example below creates a handler for the inputsourceschange event that processes the lists of added and removed from the webxr system. it looks for new and removed devices whose targetraymode is tracked-pointer. ...
XRInputSourcesChangeEvent.removed - Web APIs
examples the example below creates a handler for the inputsourceschange event that processes the lists of added and removed from the webxr system. it looks for new and removed devices whose targetraymode is tracked-pointer. ...
... examples the example below creates a handler for the inputsourceschange event that processes the lists of added and removed from the webxr system. it looks for new and removed devices whose targetraymode is tracked-pointer. ...
XRInputSourcesChangeEventInit.removed - Web APIs
the xrinputsourceschangeeventinit property removed is an array of zero or more xrinputsource objects, each representing one input source which has been removed from the xrsession. ...
... specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeeventinit.removed' in that specification. working draft initial definition. ...
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
of events, roles, states and methods. it's difficult to know which things to support. solution: use this document to see what is generally considered important by assistive technology manufacturers. contact the the top vendors early and often as you plan and implement your architecture, to see what's important to them. implement only what's needed -- supporting everything would take too long for zero results. vendor quirks problem: because assistive technology tends to utilize msaa as an additional solution resting on top of old hacks, rather than a completely clean and separate way to deal with an application, and because of the quirky nature of msaa and of the inflexible heuristics that screen readers use, we do not have a "plug and play solution". in addition, assistive technology vendor...
...ge load and scroll events. these events cause msaa-specific events, such as event_object_focus or event_object_statechange, to fire on ui and document objects within the applicable window. we'll explain more about events later in this section. until the wm_getobject message is processed, the gecko accessibility service is not used, and thus the accessibility.dll is not loaded, so there is almost zero overhead for accessibility api support in mozilla or gecko, in the general case. once the accessibility service is created, however, gecko loads code to create an object on demand for every ui or document object that should support iaccessible. the created objects are cached in a hash table, and shutdown when they're no longer needed. they may still exist in memory in a nonfunctional state until ...
:nth-last-child() - CSS: Cascading Style Sheets
s odd represents elements whose numeric position in a series of siblings is odd: 1, 3, 5, etc., counting from the end. even represents elements whose numeric position in a series of siblings is even: 2, 4, 6, etc., counting from the end. functional notation <an+b> represents elements whose numeric position in a series of siblings matches the pattern an+b, for every positive integer or zero value of n. the index of the first element, counting from the end, is 1. the values a and b must both be <integer>s. formal syntax :nth-last-child( <nth> [ of <complex-selector-list> ]? )where <nth> = <an-plus-b> | even | odd<complex-selector-list> = <complex-selector>#where <complex-selector> = <compound-selector> [ <combinator>? <compound-selector> ]*where <compound-selector> = [ <type-selec...
...n) represents elements 5, 10, 15, etc., counting from the end. :nth-last-child(3n+4) represents elements 4, 7, 10, 13, etc., counting from the end. :nth-last-child(-n+3) represents the last three elements among a group of siblings. p:nth-last-child(n) or p:nth-last-child(n+1) represents every <p> element among a group of siblings. this is the same as a simple p selector. (since n starts at zero, while the last element begins at one, n and n+1 will both select the same elements.) p:nth-last-child(1) or p:nth-last-child(0n+1) represents every <p> that is the first element among a group of siblings, counting from the end. this is the same as the :last-child selector. table example html <table> <tbody> <tr> <td>first line</td> </tr> <tr> <td>second line</td> ...
CSS Containment - CSS: Cascading Style Sheets
contain: size; } size containment does not offer much in the way of performance optimizations when used on its own. however, it means that the size of the element's children cannot affect the size of the element itself — its size is computed as if it had no children. if you turn on contain: size you need to also specify the size of the element you have applied this to. it will end up being zero-sized in most cases, if you don't manually give it a size. style containment article { contain: style; } despite the name, style containment does not provide scoped styles such as you would get with the shadow dom. the main use case is to prevent situations where a css counter could be changed in an element, which could then affect the rest of the tree. using contain: style would ensure th...
...e (it's not currently supported in firefox). special values there are two special values of contain: content strict we encountered the first in the example above. using contain: content turns on layout and paint containment. the specification describes this value as being "reasonably safe to apply widely". it does not apply size containment, so you would not be at risk of a box ending up zero-sized due to a reliance on the size of its children. to gain as much containment as possible use contain: strict, which behaves the same as contain: size layout paint, or perhaps the following to also add style containment in browsers that support it: contain: strict; contain: strict style; reference css properties contain external resources an introduction to css containment ...
Controlling Ratios of Flex Items Along the Main Axis - CSS: Cascading Style Sheets
while it is usually subtle, defined in the specification is one reason why flex-shrink isn’t quite the same for negative space as flex-grow is for positive space: “note: the flex shrink factor is multiplied by the flex base size when distributing negative space. this distributes negative space in proportion to how much the item is able to shrink, so that e.g. a small item won’t shrink to zero before a larger item has been noticeably reduced.” the second reason is that flexbox prevents small items from shrinking to zero size during this removal of negative free space. the items will be floored at their min-content size — the size that they become if they take advantage of any soft wrapping opportunities available to them. you can see this min-content flooring happen in the below...
...gs that come into play. consider the following aspects, which we have already discussed in these guides: what sets the base size of the item? is flex-basis set to auto, and does the item have a width set? if so, the size will be based on that width. is flex-basis set to auto or content (in a supporting browser)? if so, the size is based on the item size. is flex-basis a length unit, but not zero? if so this is the size of the item. is flex-basis set to 0? if so then the item size is not taken into consideration for the space-sharing calculation. do we have available space? items can’t grow with no positive free space, and they won’t shrink unless there is negative free space. if we took all of the items and added up their widths (or heights if working in a column), is that tot...
OpenType font features guide - CSS: Cascading Style Sheets
rtional spacing is the normal setting, whereas tabular spacing lines up numerals evenly regardless of character width, making it more appropriate for lining up tables of numbers in financial tables. there are two types of fractions supported through this property: diagonal slashed fractions. vertically stacked fractions. ordinals are also supported (such as '1st' or '3rd'), as is a slashed zero if present in the font. lining and oldstyle figures fractions, ordinals, and slashed zero east asian (font-variant-east-asian) this allows access to various alternate forms of glyphs within a font. the example below shows a string of glyphs with only the opentype set 'jis78' enabled. uncheck the box below and you'll see more characters displayed. note: these glyphs were copied out of ...
...e number of possible features. you can see examples of a number of them above, and there are several resources available for finding more of them. the general syntax looks like this: .small-caps { font-feature-settings: "smcp", "c2sc"; } according to the specification you can either supply just the 4-character feature code or supply a 1 following the code (for enabling that feature) or a 0 (zero) to disable it. this is helpful if you have a feature like ligatures enabled by default but you would like to turn them off, like so: .no-ligatures { font-feature-settings: "liga" 0, "dlig" 0; } more on font-feature-settings codes 'the complete css demo for opentype features' (can't vouch for the truth of the name, but it's pretty big) a list of opentype features on wikipedia using css ...
Using z-index - CSS: Cascading Style Sheets
if you are not familiar with the z-axis, imagine the page as a stack of layers, each one having a number. ...
...ach one having a number. layers are rendered in numerical order, with larger numbers above smaller numbers. bottom layer (farthest from the observer) ... layer -3 layer -2 layer -1 layer 0 (default rendering layer) layer 1 layer 2 layer 3 ... top layer (closest to the observer) notes: when no z-index property is specified, elements are rendered on the default rendering layer 0 (zero). if several elements share the same z-index value (i.e., they are placed on the same layer), stacking rules explained in the section stacking without the z-index property apply. in the following example, the layers' stacking order is rearranged using z-index. the z-index of element #5 has no effect since it is not a positioned element. source code for the example html <div id="abs1"> ...
Value definition syntax - CSS: Cascading Style Sheets
one entity from each side of the | combinator can be present. component value multipliers a multiplier is a sign that indicate how many times a preceding entity can be repeated. without a multiplier, an entity must appear exactly one time. note that multipliers cannot be added and have all precedence over combinators. asterisk (*) the asterisk multiplier indicates that the entity may appear zero, one or several times. bold smaller* this example matches the following values: bold bold smaller bold smaller smaller bold smaller smaller smaller, and so on. but not: smaller, as bold is juxtaposed, and must appear before any smaller keyword. plus (+) the plus multiplier indicates that the entity may appear one or several times. bold smaller+ this example matches the following...
...or several times. bold smaller+ this example matches the following values: bold smaller bold smaller smaller bold smaller smaller smaller, and so on. but not: bold, as smaller must appear at least one time. smaller, as bold is juxtaposed and must appear before any smaller keyword. question mark (?) the question mark multiplier indicates that the entity is optional, and must appear zero or one time. bold smaller? this example matches the following values: bold bold smaller but not: bold smaller smaller, as smaller must appear at most one time. smaller, as bold is juxtaposed and must appear before any smaller keyword. curly braces ({ }) the curly braces multiplier, enclosing two integers separated by a comma, a and b, indicates that the entity must appear at least ...
Visual formatting model - CSS: Cascading Style Sheets
ual formatting model describes how user agents take the document tree, and process and display it for visual media. this includes continuous media such as a computer screen and paged media such as a book or document printed by browser print functions. most of the information applies equally to continuous and paged media. in the visual formatting model, each element in the document tree generates zero or more boxes according to the box model. the layout of these boxes is governed by: box dimensions and type. positioning scheme (normal flow, float, and absolute positioning). relationships between elements in the document tree. external information (e.g., viewport size, intrinsic dimensions of images, etc.). much of the information about the visual formatting model is defined in css2, ho...
...anvas. to do this, it generates an intermediary structure, the box tree, which represents the formatting structure of the rendered document. each box in the box tree represents its corresponding element (or pseudo-element) in space and/or time on the canvas, while each text run in the box tree likewise represents the contents of its corresponding text nodes. then, for each element, css generates zero or more boxes as specified by that element’s display property value. note: boxes are often referred to by their display type — e.g. a box generated by an element with display: block is called a "block box" or just a "block". note however that block boxes, block-level boxes and box containers are all subtly different; see the block boxes section below for more details. the principal box w...
animation - CSS: Cascading Style Sheets
Web › CSS › animation
ent properties this property is a shorthand for the following css properties: animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function syntax the animation property is specified as one or more single animations, separated by commas. ...
...animations, separated by commas. each individual animation is specified as: zero or one occurrences of the following values: <single-transition-timing-function> <single-animation-iteration-count> <single-animation-direction> <single-animation-fill-mode> <single-animation-play-state> an optional name for the animation, which may be none, a <custom-ident>, or a <string> zero, one, or two <time> values the order of values within each animation definition is important: the first value that can be parsed as a <time> is assigned to the animation-duration, and the second one is assigned to animation-delay. the order within each animation definition is also important for distinguishing animation-name values from other keywords. when parsed, keywords that are valid for p...
box-flex - CSS: Cascading Style Sheets
Web › CSS › box-flex
erit; -webkit-box-flex: initial; -webkit-box-flex: unset; syntax the box-flex property is specified as a <number>. if the value is 0, the box does not grow. if it is greater than 0, the box grows to fill a proportion of the available space. notes the containing box allocates the available extra space in proportion to the flex value of each of the content elements. content elements that have zero flex do not grow. if only one content element has nonzero flex, then it grows to fill the available space. content elements that have the same flex grow by the same absolute amounts. if the flex value is set using the element's flex attribute, then the style is ignored. to make xul elements in a containing box the same size, set the containing box's equalsize attribute to the value always. th...
...element's flex attribute, then the style is ignored. to make xul elements in a containing box the same size, set the containing box's equalsize attribute to the value always. this attribute does not have a corresponding css property. a trick to make all content elements in a containing box the same size, is to give them all a fixed size (e.g. height: 0), and the same box-flex value greater than zero (e.g. -moz-box-flex: 1). formal definition initial value0applies toelements that are direct children of an element with a css display value of -moz-box or -moz-inline-box or -webkit-box or -webkit-inline-boxinheritednocomputed valueas specifiedanimation typediscrete formal syntax <number> examples setting box-flex <!doctype html> <html> <head> <title>-moz-box-flex example</title> ...
box-shadow - CSS: Cascading Style Sheets
the shadows are drawn back to front, so the first shadow sits on top of subsequent shadows. when the border-radius is set to 0, as is the default, the corners of the shadow will be, well, corners. had we put in a border-radius of any other value, the...
...the shadows are drawn back to front, so the first shadow sits on top of subsequent shadows. when the border-radius is set to 0, as is the default, the corners of the shadow will be, well, corners. had we put in a border-radius of any other value, the corners would have been rounded. we added a margin the size of the wide...
counters() - CSS: Cascading Style Sheets
Web › CSS › counters
></li> <li></li> <li></li> </ol> </li> </ol> </li> </ol> css ol { counter-reset: listcounter; } li { counter-increment: listcounter; } li::marker { content: counters(listcounter, '.', upper-roman) ') '; } li::before { content: counters(listcounter, ".") " == " counters(listcounter, ".", lower-roman) ; } result decimal-leading-zero compared to lower-alpha html <ol> <li> <ol> <li></li> <li></li> <li></li> </ol> </li> <li></li> <li></li> <li> <ol> <li></li> <li> <ol> <li></li> <li></li> <li></li> </ol> </li> </ol> </li> </ol> css ol { counter-reset: count; } li { counter-inc...
... working draft no change css level 2 (revision 1)the definition of 'css counters' in that specification. recommendation initial definition ...
env() - CSS: Cascading Style Sheets
Web › CSS › env
-area-inset-bottom, safe-area-inset-left the safe-area-inset-* variables are four environment variables that define a rectangle by its top, right, bottom, and left insets from the edge of the viewport, which is safe to put content into without risking it being cut off by the shape of a non‑rectangular display. for rectangular viewports, like your average laptop monitor, their value is equal to zero. for non-rectangular displays — like a round watch face — the four values set by the user agent form a rectangle such that all content inside the rectangle is visible. note: unlike other css properties, user agent-defined property names are case-sensitive. formal syntax env( <custom-ident> , <declaration-value>? ) examples the below example makes use of the optional second parameter of ...
... <code>padding: 0 0 0 50px</code>, because, unlike other css properties, user agent property names are case-sensitive. ...
font-variant - CSS: Cascading Style Sheets
, swash(), ornaments(), annotation() specifies the keywords and functions related to the font-variant-alternates longhand property. small-caps, all-small-caps, petite-caps, all-petite-caps, unicase, titling-caps specifies the keywords and functions related to the font-variant-caps longhand property. <numeric-figure-values>, <numeric-spacing-values>, <numeric-fraction-values>, ordinal, slashed-zero specifies the keywords related to the font-variant-numeric longhand property. the possible values are: lining-nums, oldstyle-nums, proportional-nums, tabular-nums, diagonal-fractions, stacked-fractions, ordinal, and slashed-zero. <east-asian-variant-values>, <east-asian-width-values>, ruby specifies the keywords related to the font-variant-east-asian longhand property. the possible values are...
... ) | historical-forms | styleset( <feature-value-name># ) | character-variant( <feature-value-name># ) | swash( <feature-value-name> ) | ornaments( <feature-value-name> ) | annotation( <feature-value-name> ) | [ small-caps | all-small-caps | petite-caps | all-petite-caps | unicase | titling-caps ] | <numeric-figure-values> | <numeric-spacing-values> | <numeric-fraction-values> | ordinal | slashed-zero | <east-asian-variant-values> | <east-asian-width-values> | ruby ]where <common-lig-values> = [ common-ligatures | no-common-ligatures ]<discretionary-lig-values> = [ discretionary-ligatures | no-discretionary-ligatures ]<historical-lig-values> = [ historical-ligatures | no-historical-ligatures ]<contextual-alt-values> = [ contextual | no-contextual ]<feature-value-name> = <custom-ident><numeric-...
gap (grid-gap) - CSS: Cascading Style Sheets
Web › CSS › gap
the gutter separating the grid lines, relative to the dimension of the element. ...
... examples flex layout html <div id="flexbox"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> </div> css #flexbox { display: flex; flex-w...
grid - CSS: Cascading Style Sheets
Web › CSS › grid
] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'> examples creating a grid layout html <div id="...
...] <'grid-auto-columns'>? | [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'> examples creating a grid layout html <div id="container"> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <div></div> <...
list-style-type - CSS: Cascading Style Sheets
of the list. <string> the specified string will be used as the item's marker. none no item marker is shown. disc a filled circle (default value) circle a hollow circle square a filled square decimal decimal numbers beginning with 1 cjk-decimal han decimal numbers e.g. 一, 二, 三, ..., 九八, 九九, 一〇〇 decimal-leading-zero decimal numbers padded by initial zeros e.g. 01, 02, 03, … 98, 99 lower-roman lowercase roman numerals e.g. i, ii, iii, iv, v… upper-roman uppercase roman numerals e.g. i, ii, iii, iv, v… lower-greek lowercase classical greek alpha, beta, gamma… e.g. α, β, γ… lower-alpha lower-latin lowercase ascii letters e.g. a, b, c,...
...hame-ti-et example hangul -moz-hangul example example example hangul-consonant -moz-hangul-consonant example example example urdu -moz-urdu example accessibility concerns the voiceover screen reader has an issue where unordered lists with a list-style-type value of none applied to them will not be announced as a list. to address this, add a zero-width space as pseudo content before each list item to ensure the list is announced properly. this ensures the design is unaffected by the bug fix and that list items are not improperly described. ul { list-style: none; } ul li::before { content: "\200b"; } voiceover and list-style-type: none – unfettered thoughts mdn understanding wcag, guideline 1.3 explanations understanding suc...
shape-outside - CSS: Cascading Style Sheets
fallback image, the effect is as if the value none had been specified. interpolation when animating between one <basic-shape> and a second, the rules below are applied. the values in the shape functions interpolate as a simple list. the list values interpolate as <length>, <percentage>, or calc() where possible. if list values are not one of those types but are identical (such as finding nonzero in the same list position in both lists), those values do interpolate. both shapes must use the same reference box. if both shapes are the same type, that type is ellipse() or circle(), and none of the radii use the closest-side or farthest-side keywords, interpolate between each value in the shape functions. if both shapes are of type inset(), interpolate between each value in the shape fun...
...adient()>where <length-percentage> = <length> | <percentage><shape-radius> = <length-percentage> | closest-side | farthest-side<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<fill-rule> = nonzero | evenodd<image-tags> = ltr | rtl<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color><image-set-option> = [ <image> | <string> ] <resolution><id-selector> = <hash-token><cf-mixing-image> = <percentage>? && <image><cf-final-image> = <image> | <color><linear-gradient()> = linear-gradient( [ <angle> |...
<picture>: The Picture element - HTML: Hypertext Markup Language
Web › HTML › Element › picture
the browser will consider each child <source> element and choose the best match among them. if no matches are found—or the browser doesn't support the <picture> element—the url of the <img> element's src attribute is selected. the selected image is then presented in the space occupied by the <img> element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...priate image for the viewer's display. if providing higher-density versions of an image for high-dpi (retina) display, use srcset on the <img> element instead. this lets browsers opt for lower-density versions in data-saving modes, and you don't have to write explicit media conditions. content categories flow content, phrasing content, embedded content permitted content zero or more <source> elements, followed by one <img> element, optionally intermixed with script-supporting elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that allows embedded content. implicit aria role no corresponding role permitted aria roles no role permitted dom interface htmlp...
Using the application cache - HTML: Hypertext Markup Language
ation cache manifest, as defined in this section. cache manifests are utf-8 format text files, and may optionally include a bom character. newlines may be represented by line feed (u+000a), carriage return (u+000d), or carriage return and line feed both. ...
...ter. newlines may be represented by line feed (u+000a), carriage return (u+000d), or carriage return and line feed both. the first line of the cache manifest must consist of the string cache manifest (with a single u+0020 space between the two words), followed by zero or more space or tab characters. any other text on the line is ignored. the remainder of the cache manifest must be comprised of zero or more of the following lines: blank line you may use blank lines comprised of zero or more space and tab characters. comment comments consist of zero or more tabs or spaces followed by a single # character, followed by zero or more characters of comment text. comments may only be used on their own lines (after the initial cache manifest line), and cannot be appended to other lines. this m...
Set-Cookie - HTTP
red out from any response exposed to frontend code. for more information, see the guide on http cookies. ...
... warning: many web browsers have a session restore feature that will save all tabs and restore them next time the browser is used. session cookies will also be restored, as if the browser was never closed. when an expires date is set, the deadline is relative to the client the cookie is being set on, not the server. max-age=<number> optional number of seconds until the cookie expires. a zero or negative number will expire the cookie immediately. if both expires and max-age are set, max-age has precedence. domain=<domain-value> optional host to which the cookie will be sent. if omitted, defaults to the host of the current document url, not including subdomains. contrary to earlier specifications, leading dots in domain names (.example.com) are ignored. multiple host/domain v...
SyntaxError: "0"-prefixed octal literals and octal escape seq. are deprecated - JavaScript
allowed in strict mode (edge) syntaxerror: "0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead error type syntaxerror in strict mode only. what went wrong? octal literals and octal escape sequences are deprecated and will throw a syntaxerror in strict mode. ...
...ding zero followed by a lowercase or uppercase latin letter "o" (0o or 0o). ...
SyntaxError: JSON.parse: bad parsing - JavaScript
omit the trailing commas to parse the json correctly: json.parse('[1, 2, 3, 4]'); json.parse('{"foo": 1}'); property names must be double-quoted strings you cannot use single-quotes around properties, like 'foo'. json.parse("{'foo': 1}"); // syntaxerror: json.parse: expected property name or '}' // at line 1 column 2 of the json data instead write "foo": json.parse('{"foo": 1}'); leading zeros and decimal points you cannot use leading zeros, like 01, and decimal points must be followed by at least one digit. json.parse('{"foo": 01}'); // syntaxerror: json.parse: expected ',' or '}' after property value // in object at line 1 column 2 of the json data json.parse('{"foo": 1.}'); // syntaxerror: json.parse: unterminated fractional number // at line 1 column 2 of the json data instea...
... cannot use leading zeros, like 01, and decimal points must be followed by at least one digit. ...
Array.prototype.copyWithin() - JavaScript
part of an array to another location in the same array and returns it without modifying its length. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.copywithin(target[, start[, end]]) parameters target zero-based index at which to copy the sequence to. if negative, target will be counted from the end. if target is at or greater than arr.length, nothing will be copied. if target is positioned after start, the copied sequence will be trimmed to fit arr.length. start optional zero-based index at which to start copying elements from. if negative, start will be counted from the end. if start is omitt...
...copywithin copies up to but not including end. if negative, end will be counted from the end. ...
Array.prototype.shift() - JavaScript
he array. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.shift() return value the removed element from the array; undefined if the array is empty. ...
... array.prototype.pop() has similar behavior to shift, but applied to the last element in an array. examples removing an element from an array the following code displays the myfish array before and after removing its first element. ...
Array.prototype.splice() - JavaScript
ce() will only remove elements from the array. return value an array containing the deleted elements. if only one element is removed, an array of one element is returned. if no elements are removed, an empty array is returned. description if the specified number of elements to insert differs from the number of elements being removed, the array's length will be changed. ...
... number of elements to insert differs from the number of elements being removed, the array's length will be changed. ...
Array - JavaScript
ms to be removed, // starting at the index position specified by pos and progressing toward the end of array. console.log(vegetables) // ["cabbage", "carrot"] (the original array is changed) console.log(removeditems) // ["turnip", "radish"] copy an array let shallowcopy = fruits.slice() // this is how to make a copy // ["strawberry", "mango"] accessing array elements javascript arrays are zero-indexed. the first element of an array is at index 0, and the last element is at the index value equal to the value of the array's length property minus 1. using an invalid index number returns undefined. let arr = ['this is the first element', 'this is the second element', 'this is the last element'] console.log(arr[0]) // logs 'this is the first element' console.log(arr[1]) ...
...mber matched b's and the following d // ignore case const myre = /d(b+)(d)/i const myarray = myre.exec('cdbbdbsbz') the properties and elements returned from this match are as follows: property/element description example input read only the original string against which the regular expression was matched. "cdbbdbsbz" index read only the zero-based index of the match in the string. 1 [0] read only the last matched characters. "dbbd" [1], ...[n] read only elements that specify the parenthesized substring matches (if included) in the regular expression. the number of possible parenthesized substrings is unlimited. [1]: "bb" [2]: "d" constructor array() creates a new array object.
ArrayBuffer.prototype.slice() - JavaScript
rraybuffer whose contents are a copy of this arraybuffer's bytes from begin, inclusive, up to end, exclusive. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arraybuffer.slice(begin[, end]) parameters begin zero-based byte index at which to begin slicing. end optional byte index before which to end slicing. if end is unspecified, the new arraybuffer contains all bytes from begin to the end of this arraybuffer. return value a new arraybuffer object. description the slice() method copies up to, but not including, the byte indicated by the end parameter. if either begin or end is negative, it refe...
...ice() method copies up to, but not including, the byte indicated by the end parameter. if either begin or end is negative, it refers to an index from the end of the array, as opposed to from the beginning. the range specified by the begin and end parameters is clamped to the valid index range for the current array. if the computed length of the new arraybuffer would be negative, it is clamped to zero. examples copying an arraybuffer const buf1 = new arraybuffer(8); const buf2 = buf1.slice(0); specifications specification ecmascript (ecma-262)the definition of 'arraybuffer.prototype.slice' in that specification. ...
Date.prototype.toDateString() - JavaScript
"thu jan 01 1970". the source for this interactive example is stored in a github repository. ...
..."thu jan 01 1970". the source for this interactive example is stored in a github repository. ...
Date.prototype.toUTCString() - JavaScript
pull request. syntax dateobj.toutcstring() return value a string representing the given date using the utc time zone. description the value returned by toutcstring() is a string in the form www, dd mmm yyyy hh:mm:ss gmt, where: format sring description www day of week, as three letters (e.g. ...
...the value returned by toutcstring() is a string in the form www, dd mmm yyyy hh:mm:ss gmt, where: format sring description www day of week, as three letters (e.g. sun, mon, ...) dd day of month, as two digits with leading zero if required mmm month, as three letters (e.g. jan, feb, ...) yyyy year, as four or more digits with leading zeroes if required hh hour, as two digits with leading zero if required mm minute, as two digits with leading zero if required ss seconds, as two digits with leading zero if required prior to ecmascript 2018, the format of the return value varied according to the platform. the most common return value was an rfc-1123 formatted date stamp, which is a slightly ...
Intl.NumberFormat() constructor - JavaScript
lude: "arab", "arabext", " bali", "beng", "deva", "fullwide", " gujr", "guru", "hanidec", "khmr", " knda", "laoo", "latn", "limb", "mlym", " mong", "mymr", "orya", "tamldec", " telu", "thai", "tibt". signdisplay when to display the sign for the number; defaults to "auto" "auto" sign display for negative numbers only "never" never display sign "always" always display sign "exceptzero" sign display for positive and negative numbers, but not zero style the formatting style to use , the default is "decimal". "decimal" for plain number formatting. "currency" for currency formatting. "percent" for percent formatting "unit" for unit formatting unit the unit to use in unit formatting, possible values are core unit identifiers, defined in uts #35, p...
...intl.numberformat('zh-cn', { notation: "compact" }).format(987654321); // → 9.9亿 new intl.numberformat('fr', { notation: "compact", compactdisplay: "long" }).format(987654321); // → 988 millions new intl.numberformat('en-gb', { notation: "compact", compactdisplay: "short" }).format(987654321); // → 988m displaying signs display a sign for positive and negative numbers, but not zero: new intl.numberformat("en-us", { style: "percent", signdisplay: "exceptzero" }).format(0.55); // → '+55%' note that when the currency sign is "accounting", parentheses might be used instead of a minus sign: new intl.numberformat('bn', { style: 'currency', currency: 'usd', currencysign: 'accounting', signdisplay: 'always' }).format(-3500); // → '($3,500.00)' specification...
Intl.PluralRules.select() - JavaScript
the intl.pluralrules.prototype.select method returns a string indicating which plural rule to use for locale-aware formatting. syntax pluralcategory = pluralrule.select(number) parameters number the number to get a plural rule for. return value a string representing the pluralization category of the number, can be one of zero, one, two, few, many or other. ...
... parameters number the number to get a plural rule for. return value a string representing the pluralization category of the number, can be one of zero, one, two, few, many or other. description this function selects a pluralization category according to the locale and formatting options of a pluralrules object. examples using select() new intl.pluralrules('ar-eg').select(0); // → 'zero' new intl.pluralrules('ar-eg').select(1); // → 'one' new intl.pluralrules('ar-eg').select(2); // → 'two' new intl.pluralrules('ar-eg').select(6); // → 'few' new intl.pluralrules('ar-eg').select(18); // → 'many' specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.pluralrules.select()' in that specification. ...
Math - JavaScript
x. math.asinh(x) returns the hyperbolic arcsine of a number. math.atan(x) returns the arctangent of x. math.atanh(x) returns the hyperbolic arctangent of x. math.atan2(y, x) returns the arctangent of the quotient of its arguments. math.cbrt(x) returns the cube root of x. math.ceil(x) returns the smallest integer greater than or equal to x. math.clz32(x) returns the number of leading zeroes of the 32-bit integer x. math.cos(x) returns the cosine of x. math.cosh(x) returns the hyperbolic cosine of x. math.exp(x) returns ex, where x is the argument, and e is euler's constant (2.718…, the base of the natural logarithm). math.expm1(x) returns subtracting 1 from exp(x). math.floor(x) returns the largest integer less than or equal to x. math.fround(x) returns the nearest s...
...s. math.imul(x, y) returns the result of the 32-bit integer multiplication of x and y. math.log(x) returns the natural logarithm (㏒e; also, ㏑) of x. math.log1p(x) returns the natural logarithm (㏒e; also ㏑) of 1 + x for the number x. math.log10(x) returns the base-10 logarithm of x. math.log2(x) returns the base-2 logarithm of x. math.max([x[, y[, …]]]) returns the largest of zero or more numbers. math.min([x[, y[, …]]]) returns the smallest of zero or more numbers. math.pow(x, y) returns base x to the exponent power y (that is, xy). math.random() returns a pseudo-random number between 0 and 1. math.round(x) returns the value of the number x rounded to the nearest integer. math.sign(x) returns the sign of the x, indicating whether x is positive, negative, or ze...
Number.prototype.toFixed() - JavaScript
a rangeerror. implementations are allowed to support larger and smaller values as chosen. typeerror if this method is invoked on an object that is not a number. description tofixed() returns a string representation of numobj that does not use exponential notation and has exactly digits digits after the decimal place. the number is rounded if necessary, and the fractional part is padded with zeros if necessary so that it has the specified length. if the absolute value of numobj is greater or equal to 1e+21, this method simply calls number.prototype.tostring() and returns a string in exponential notation. warning: floating point numbers cannot represent all decimals precisely in binary. this can lead to unexpected results, such as 0.1 + 0.2 === 0.3 returning false . examples using tof...
...ting point numbers cannot represent all decimals precisely in binary. this can lead to unexpected results, such as 0.1 + 0.2 === 0.3 returning false . examples using tofixed let numobj = 12345.6789 numobj.tofixed() // returns '12346': note rounding, no fractional part numobj.tofixed(1) // returns '12345.7': note rounding numobj.tofixed(6) // returns '12345.678900': note added zeros (1.23e+20).tofixed(2) // returns '123000000000000000000.00' (1.23e-10).tofixed(2) // returns '0.00' 2.34.tofixed(1) // returns '2.3' 2.35.tofixed(1) // returns '2.4'. note it rounds up 2.55.tofixed(1) // returns '2.5'. note it rounds down - see warning above -2.34.tofixed(1) // returns -2.3 (due to operator precedence, negative number literals don't return a string..
String.prototype.split() - JavaScript
like this: mystring.split("\t"). if separator contains multiple characters, that entire character sequence must be found in order to split. if separator is omitted or does not occur in str, the returned array contains one element consisting of the entire string. if separator appears at the beginning (or end) of the string, it still has the effect of splitting. the result is an empty (i.e. zero length) string, which appears at the first (or last) position of the returned array. if separator is an empty string (""), str is converted to an array of each of its utf-16 "characters". warning: when the empty string ("") is used as a separator, the string is not split by user-perceived characters (grapheme clusters) or unicode characters (codepoints), but by utf-16 codeunits. this dest...
...t has such people in it." the separator is: "undefined" the array has 1 elements: oh brave new world that has such people in it. the original string is: "jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec" the separator is: "," the array has 12 elements: jan / feb / mar / apr / may / jun / jul / aug / sep / oct / nov / dec removing spaces from a string in the following example, split() looks for zero or more spaces, followed by a semicolon, followed by zero or more spaces—and, when found, removes the spaces and the semicolon from the string. namelist is the array returned as a result of split(). const names = 'harry trump ;fred barney; helen rigby ; bill abel ;chris hand ' console.log(names) const re = /\s*(?:;|$)\s*/ const namelist = names.split(re) console.log(namelist) this logs tw...
isNaN() - JavaScript
luate to false. hence, the necessity of an isnan function. origin of nan values nan values are generated when arithmetic operations result in undefined or unrepresentable values. such values do not necessarily represent overflow conditions. a nan also results from attempted coercion to numeric values of non-numeric values for which no primitive numeric value is available. for example, dividing zero by zero results in a nan — but dividing other numbers by zero does not. confusing special-case behavior since the very earliest versions of the isnan function specification, its behavior for non-numeric arguments has been confusing. when the argument to the isnan function is not of type number, the value is first coerced to a number. the resulting value is then tested to determine whether it ...
...for non-numeric arguments has been confusing. when the argument to the isnan function is not of type number, the value is first coerced to a number. the resulting value is then tested to determine whether it is nan. thus for non-numbers that when coerced to numeric type result in a valid non-nan numeric value (notably the empty string and boolean primitives, which when coerced give numeric values zero or one), the "false" returned value may be unexpected; the empty string, for example, is surely "not a number." the confusion stems from the fact that the term, "not a number", has a specific meaning for numbers represented as ieee-754 floating-point values. the function should be interpreted as answering the question, "is this value, when coerced to a numeric value, an ieee-754 'not a number' va...
Left shift (<<) - JavaScript
for example, 9 << 2 yields 36: . ...
...he right. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a << b description this operator shifts the first operand the specified number of bits to the left. excess bits shifted off to the left are discarded. zero bits are shifted in from the right. for example, 9 << 2 yields 36: . 9 (base 10): 00000000000000000000000000001001 (base 2) -------------------------------- 9 << 2 (base 10): 00000000000000000000000000100100 (base 2) = 36 (base 10) bitwise shifting any number x to the left by y bits yields x * 2 ** y. so e.g.: 9 << 3 translates to: 9 * (2 ** 3) = 9 * (8) = 72. examples ...
Spread syntax (...) - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
Unsigned right shift (>>>) - JavaScript
the unsigned right shift operator (>>>) (zero-fill right shift) shifts the first operand the specified number of bits to the right. excess bits shifted off to the right are discarded. zero bits are shifted in from the left. the sign bit becomes 0, so the result is always non-negative. unlike the other bitwise operators, zero-fill right shift returns an unsigned 32-bit integer. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a >>> b description this operator shifts the first operand the specified number of bits to the right. ...
...teger. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a >>> b description this operator shifts the first operand the specified number of bits to the right. excess bits shifted off to the right are discarded. zero bits are shifted in from the left. the sign bit becomes 0, so the result is always non-negative. unlike the other bitwise operators, zero-fill right shift returns an unsigned 32-bit integer. for non-negative numbers, zero-fill right shift and sign-propagating right shift yield the same result. for example, 9 >>> 2 yields 2, the same as 9 >> 2: . 9 (base 10): 00000000000000000000000000001001...
async function - JavaScript
unction’s name. param the name of an argument to be passed to the function. statements the statements comprising the body of the function. the await mechanism may be used. return value a promise which will be resolved with the value returned by the async function, or rejected with an exception thrown from, or uncaught within, the async function. description async functions can contain zero or more await expressions. await expressions suspend progress through an async function, yielding control and subsequently resuming progress only when an awaited promise-based asynchronous operation is either fulfilled or rejected. the resolved value of the promise is treated as the return value of the await expression. use of async / await enables the use of ordinary try / catch blocks around as...
... combining generators and promises. async functions always return a promise. if the return value of an async function is not explicitly a promise, it will be implicitly wrapped in a promise. for example, the following: async function foo() { return 1 } ...is equivalent to: function foo() { return promise.resolve(1) } the body of an async function can be thought of as being split by zero or more await expressions. top-level code, up to and including the first await expression (if there is one), is run synchronously. in this way, an async function without an await expression will run synchronously. if there is an await expression inside the function body, however, the async function will always complete asynchronously. for example: async function foo() { await 1 } ...is equ...
SVG Presentation Attributes - SVG: Scalable Vector Graphics
es clip deprecated it defines what portion of an element is visible. value: auto|<shape()>|inherit; animatable: yes clip-path it binds the element it is applied to with a given <clippath> element. value: none|<funciri>|inherit; animatable: yes clip-rule it indicates how to determine what side of a path is inside a shape in order to know how a <clippath> should clip its target. value: nonezero|evenodd|inherit; animatable: yes color it provides a potential indirect value (currentcolor) for the fill, stroke, stop-color, flood-color and lighting-color presentation attributes. value: <color>|inherit; animatable: yes color-interpolation it specifies the color space for gradient interpolations, color animations, and alpha compositing. value: auto|srgb|linearrgb|inherit; animatable: yes...
...ue: accumulate|new|inherit; animatable: no fill it defines the color of the inside of the graphical element it applies to. value: <paint>; animatable: yes fill-opacity it specifies the opacity of the color or the content the current object is filled with. value: <number>|<percentage>; animatable: yes fill-rule it indicates how to determine what side of a path is inside a shape. value: nonzero|evenodd|inherit; animatable: yes filter it defines the filter effects defined by the <filter> element that shall be applied to its element. value: <funciri>|none|inherit; animatable: yes flood-color it indicates what color to use to flood the current filter primitive subregion defined through the <feflood> or <fedropshadow> element. value: <color>; animatable: yes flood-opacity it indicat...
edgeMode - SVG: Scalable Vector Graphics
le yes duplicate this value indicates that the input image is extended along each of its borders as necessary by duplicating the color values at the given edge of the input image. wrap this value indicates that the input image is extended by taking the color values from the opposite edge of the image. none this value indicates that the input image is extended with pixel values of zero for r, g, b and a. fegaussianblur for <fegaussianblur>, edgemode determines how to extend the input image as necessary with color values so that the matrix operations can be applied when the kernel is positioned at or near the edge of the input image. value duplicate | wrap | none default value none animatable yes duplicate this value indicates th...
...le yes duplicate this value indicates that the input image is extended along each of its borders as necessary by duplicating the color values at the given edge of the input image. wrap this value indicates that the input image is extended by taking the color values from the opposite edge of the image. none this value indicates that the input image is extended with pixel values of zero for r, g, b and a. specifications specification status comment filter effects module level 1the definition of 'edgemode for <fegaussianblur>' in that specification. working draft initial definition for <fegaussianblur> filter effects module level 1the definition of 'edgemode for <feconvolvematrix>' in that specification. working draft no change ...
r - SVG: Scalable Vector Graphics
Web › SVG › Attribute › r
r="25"/> <circle cx="250" cy="50" r="50"/> <rect x="20" y="120" width="60" height="60" fill="url(#mygradient000)" /> <rect x="120" y="120" width="60" height="60" fill="url(#mygradient050)" /> <rect x="220" y="120" width="60" height="60" fill="url(#mygradient100)" /> </svg> circle for <circle>, r defines the radius of the circle and therefor its size. with a value lower or equal to zero the circle won't be drawn at all. value <length> | <percentage> default value 0 animatable yes note: starting with svg2, r is a geometry property meaning this attribute can also be used as a css property for circles. radialgradient for <radialgradient>, r defines the radius of the end circle for the radial gradient. the gradient will be drawn such th...
... 0 animatable yes note: starting with svg2, r is a geometry property meaning this attribute can also be used as a css property for circles. radialgradient for <radialgradient>, r defines the radius of the end circle for the radial gradient. the gradient will be drawn such that the 100% gradient stop is mapped to the perimeter of this end circle. a value of lower or equal to zero will cause the area to be painted as a single color using the color and opacity of the last gradient <stop>. value <length> | <percentage> default value 50% animatable yes specifications specification status comment scalable vector graphics (svg) 2the definition of 'r' in that specification. candidate recommendation de...
Content type - SVG: Scalable Vector Graphics
if specified, must be in lower case. when angles are used in an svg attribute, <angle> is instead defined as follows: angle ::= number ("deg" | "grad" | "rad")? the unit identifiers in such <angle> values must be in lower case. in the svg dom, <angle> values are represented using svgangle or svganimatedangle objects. anything <anything> the basic type <anything> is a sequence of zero or more characters. specifically: anything ::= char* where char is the production for a character, as defined in xml 1.0 , section 2.2. clock-value <clock-value> clock values have the same syntax as in smil animation specification. the grammar for clock values is repeated here: clock-val ::= full-clock-val | partial-clock-val | timecount-val full-cloc...
...olors used by objects in the user's environment. the normative definition of these keywords is found in user preferences for colors (css2, section 18.2). the format of an rgb value in hexadecimal notation is a "#" immediately followed by either three or six hexadecimal characters. the three-digit rgb notation (#rgb) is converted into six-digit form (#rrggbb) by replicating digits, not by adding zeros. for example, #fb0 expands to #ffbb00. this ensures that white (#ffffff) can be specified with the short notation (#fff) and removes any dependencies on the color depth of the display. the format of an rgb value in the functional notation is an rgb start-function, followed by a comma-separated list of three numerical values (either three integer values or three percentage values) followed by ")"...
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
ce between successive columns and rows in the kernel matrix. 118 kerning deprecated, svg, svg attribute the kerning attribute indicates whether the spacing between glyphs should be adjusted based on kerning tables that are included in the relevant font (i.e., enable auto-kerning) or instead disable auto-kerning and set the spacing between them to a specific length (typically, zero). 119 keypoints svg, svg attribute the keypoints attribute indicates the simple duration of an animation. 120 keysplines svg, svg attribute the keysplines attribute defines a set of bézier curve control points associated with the keytimes list, defining a cubic bézier function that controls interval pacing. this attribute is ignored unless the calcmo...
..., a browser tab or an (x)html iframe or object element) into which a document is to be opened when the link is activated: 216 targetx filters, needsexample, svg, svg attribute the targetx attribute determines the positioning in horizontal direction of the convolution matrix relative to a given target pixel in the input image. the leftmost column of the matrix is column number zero. the value must be such that: 0 <= targetx < orderx. 217 targety filters, needsexample, svg, svg attribute the targety attribute determines the positioning in vertical direction of the convolution matrix relative to a given target pixel in the input image. the topmost row of the matrix is row number zero. the value must be such that: 0 <= targety < ordery. 218 text...
round - XPath
Web › XPath › Functions › round
defined xpath 1.0 4.4 gecko support supported. ...
... defined xpath 1.0 4.4 gecko support supported. ...
<xsl:decimal-format> - XSLT: Extensible Stylesheet Language Transformations
ts, exslt functions, xpath functions, xpath axes the <xsl:decimal-format> element defines the characters and symbols that are to be used in converting numbers into strings using theformat-number( ) function. syntax <xsl:decimal-format name=name decimal-separator=character grouping-separator=character infinity=string minus-sign=character nan=string percent=character per-mille=charater zero-digit=character digit=character pattern-separator=character /> required attributes none. optional attributes name specifies a name for this format. decimal-separator specifies the decimal point character. the default is (.). grouping-separator specifies the thousands separator character. the default is (,). infinity specifies the string used to represent infinity. the defa...
...ed to represent infinity. the default is the string "infinity". minus-sign specifies the minus sign character. the default is the hyphen (-). nan specifies the string used when the value is not a number. the default is the string "nan". percent specifies the percentage sign character. the default is (%). per-mille specifies the per thousand character. the default is (‰). zero-digit specifies the digit zero character. the default is (0). digit specifies the character used in the format pattern to stand for a digit. the default is (#). pattern-separator specifies the character separating positive and negative subpatterns in a format pattern. the default is the semi-colon (;). type top-level, must be the child of <xsl:stylesheet> or <xsl:transform>. define...
simple-storage - Archive of obsolete content
s simple-storage programmatically from the console using the following: loader.modules['resource://gre/modules/commonjs/sdk/simple-storage.js'].exports.storage clarification from mozilla needed: writing the above line in add-on debugger console results in "referenceerror: loader is not defined". constructing arrays be careful to construct array objects conditionally in your code, or you may zero them each time the construction code runs. for example, this add-on tries to store the urls of pages the user visits: var ss = require("sdk/simple-storage"); ss.storage.pages = []; require("sdk/tabs").on("ready", function(tab) { ss.storage.pages.push(tab.url); }); require("sdk/ui/button/action").actionbutton({ id: "read", label: "read", icon: "./read.png", onclick: function() { c...
io/file - Archive of obsolete content
ts are assumed to be utf-8. if mode is not given, "r" is assumed, and the file is opened in read-only text mode. apart from these options, this api always passes the following options: create_file, truncate (see //github.com/realityripple/uxp/blob/master/nsprpub/pr/include/prio.h#550). this means that: if the file does not exist it is created if the file exists, its length is truncated to zero it is not possible to open the file in append mode. returns stream : if the file is opened in text read-only mode, a textreader is returned, and if text write-only mode, a textwriter is returned. see text-streams for information on these text stream objects. if the file is opened in binary read-only mode, a bytereader is returned, and if binary write-only mode, a bytewriter is returned. see b...
cfx - Archive of obsolete content
supply a different location for signing keys. keydir may be specified as a full path or as a path relative to the current directory. --logfile=logfile log console output to the file specified by logfile. logfile may be specified as a full path or as a path relative to the current directory. --profile-memory=profilememory if this option is given and profilememory is any non-zero integer, then cfx dumps detailed memory usage information to the console when the tests finish. --test-runner-pkg=test_runner_pkg name of package containing test runner program. defaults to test-harness. cfx xpi this tool is used to package your add-on as an xpi file, which is the install file format for mozilla add-ons. called with no options, this command looks for a file c...
Enhanced Extension Installation - Archive of obsolete content
a lower install location. if there is one, then the item is uninstalled and an entry is added to the pending operations list that indicates the item at the lower install location needs to be installed. the install operation finalization process loops continuously installing, upgrading and uninstalling items at progressively lower locations until the size of the pending operations list is finally zero. little things this upgrade fixes or changes it used to not be possible to move items in the extension manager ui up and down if there were items that were from two different install locations in the list - that is there were actually two rdf containers and ordering is unique to each. by moving to a unified datasource where install location containment is expressed as a property, user-defined o...
JavaScript Object Management - Archive of obsolete content
lay of 10-15ms (taken from this blog post), so it won't really run instantly. it is more than enough to let the window finish its load. use window.settimeout and window.setinterval to control timed code execution. in case you're using javascript code modules or xpcom objects, where a window object is not readily available, use an nsitimer instead. this post suggests a way to achieve a true zero ms timeout, as a simple way to achieve parallelism in js code. notice the way we send callback functions as parameters, and the use of an alternate reference for this which we always name that. this is all necessary due to a javascript feature (quirk would be a better word for it) called method binding. the consequence of doing this wrong is to have a this reference that doesn't do what you expe...
MozOrientation - Archive of obsolete content
ard you). the z axis represents acceleration vertically. the value is -1 when the device is undergoing standard earth gravity (9.8m/sec2) but not moving. moving the device upward causes the value to increase. the value is 0 if the device is being thrust upward. in free fall (weightless or falling as a result of a drop), the value remains -1. in weightlessness, all values would be zero when the device is not moving, regardless of orientation, and would only change when being accelerated. in firefox versions 3.6, 4, and 5 gecko utilized mozorientation which was also built to support orientation data but with different apis from the specified deviceorientationevent. to normalize between the two you can do something like this: function orientationhandler(ev...
progress - Archive of obsolete content
ansfer is known. read only. loaded unsigned long (long) the number of bytes transferred since the beginning of the operation. this doesn't include headers and other overhead, but only the content itself. read only. total unsigned long (long) the total number of bytes of content that will be transferred during the operation. if the total size is unknown, this value is zero. read only. related events checking noupdate downloading progress cached updateready obsolete error ...
JavaScript Client API - Archive of obsolete content
one or more mozilla components. what events you listen for is entirely up to you. you can find out more about registering as an observer here: [link]. the score the '''score''' is stored in this.score, a variable defined by the base tracker class. set your score by assigning a value to this.score. the score number is used by the scheduler to decide when your engine will be synced. setting it to zero means "i have no need to sync". the higher you set this number, the more urgently the scheduler treats your request. setting it to 100 means "sync me immediately". it's up to you to figure out the best way to assign a score based on the current state of whatever data type you're tracking. your tracker score is automatically reset to zero after each time your engine syncs. the changed guid list ...
JavaScript OS.Shared - Archive of obsolete content
global object os.shared.type properties void_t voidptr_t char jschar int unsigned_int int32_t uint32_t int64_t uint64_t long bool off_t size_t ssize_t fd (unix only) negativeone_or_fd (unix only) negativeone_or_nothing (unix only) string (unix only) null_or_string (unix only) handle (windows only) maybe_handle (windows only) dword (windows only) negative_or_dword (windows only) zero_or_dword (windows only) zero_or_nothing (windows only) declareffi() intn_t() uintn_t()instances of os.shared.type convert_from_c() releasewith() attributes global object os.shared.hollowstructure in_ptr out_ptr inout_ptr ...
Menu - Archive of obsolete content
Archive › Mozilla › Jetpack › UI › Menu
targets some methods act on existing items within a menu. existing items are always identified using targets. a target is a string, regular expression, or integer. a string target is case-insensitively matched against the label, id, and xulid properties of menuitems. a regular expression target is tested against the label, id, and xulid properties of menuitems. an integer target indicates a zero-based index within a menu. integer targets can be negative: -1 indicates the last item in a menu, -2 the second-to-last, and so on. multiple items in a menu may match a target, but action is only ever taken on the first matching item. examples before running any examples, import the api from the future: jetpack.future.import("menu"); snippets add a single, static menuitem to the jetpack menu tha...
Microsummary XML grammar reference - Archive of obsolete content
s> element identifies the set of pages that the generator is able to summarize. attributes: none. child elements: <include> (optional) a regular expression matching the urls of pages that the generator is able to summarize. <exclude> (optional) a regular expression matching the urls of pages that the generator is not able to summarize. the <pages> element can contain zero or more <include> and <exclude> child elements, each of which must contain a valid javascript-compatible regular expression. it must not contain any other elements, and it does not have any attributes. when a generator is examined to determine whether or not it is able to summarize a page, the regular expressions provided by the child elements are evaluated against the url of the page. a generato...
Modularization techniques - Archive of obsolete content
rformed using the queryinterface() method. the caller passes in an id and a pointer to a address to place the resulting interface. if the query is successful, queryinterface() will return ns_ok. if the object does not support the given interface, it will return ns_nointerface. reference counting is performed using the addref() and release() methods. an objects reference count generally starts at zero. addref() increments that reference count, and release() decrements it. if a call to release() causes the reference count to hit zero, the object will generally free itself. a successful queryinterface() will call addref() on the requested interface before returning. both addref() and release() return the resulting reference count. the convenience macros ns_addref() and ns_release() are preferre...
Nanojit - Archive of obsolete content
ntermediate representation". a compiler's lir is typically one of several partly-compiled representations of a program that a compiler produces on the way from raw source code to machine code. an application using nanojit creates a nanojit::lirbuffer object to hold lir instructions. it creates a nanojit::lirbufwriter object to write instructions to the buffer. then it wraps the lirbufwriter in zero or more other lirwriter objects, all of which implement the same interface as lirbufwriter. this chain of lirwriter objects forms a pipeline for the instructions to pass through. each lirwriter can perform an optimization or other task on the program as it passes through the system and into the lirbuffer. once the instructions are in the lirbuffer, the application calls nanojit::compile() to pr...
Actionscript Acceptance Tests - Archive of obsolete content
: eastern standard time/eastern daylight time = ('est','edt') # write timezones as tuples, one to each line. ('est', 'edt') ('cst', 'cdt') ('mst', 'mdt') ('pst', 'pdt') testname.err this file is used when the test throws an uncatchable error. the first line must contain the expected error (without the extra debugger information). the exitcode is optional, but must be defined in this file if non-zero. verifyerror: error #1021 exitcode: 1 testname.exitcode file that specifies the expected exitcode. should just be an integer with nothing else. (note that if a .err file is defined, the .exitcode file will be ignored). in this example the .as test runs out of memory and so the expected exitcode is: 128 testname.out file that specifies expected output. this should only be used when it is not...
Elements - Archive of obsolete content
not edit only on the basis of another xbl specification. <!element bindings ( binding* ) > hierarchy: root element may contain: <binding> the bindings element is the root element of any xbl document. it should usually declare xbl as the default namespace (unless an xbl namespace prefix is used) and it may additionally declare other namespace prefixes used in your binding. bindings contains zero or more binding elements as children. each binding child element defines a unique binding that can be attached to elements in other documents. an element can have only one binding attached (explicitly or inherited) at one moment. from several bindings only the last in the sequence will be used (like with any css rule). helloworld.html: <!doctype html public "-//w3c//dtd html 4.01//en"> <html> ...
init - Archive of obsolete content
...
createKey - Archive of obsolete content
bkey, string classname); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". classname usually an empty string. for information on this parameter, see the description of regcreatekeyex in your windows api documentation. returns 0 if it succeeded; a nonzero number if it failed to schedule the creation. for a list of possible values, see return codes. description the createkey method adds a key to the registry. you must add a key to the registry before you can add a value for that key. ...
deleteKey - Archive of obsolete content
deletekey removes a key from the registry. method of winreg object syntax int deletekey ( string subkey); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". returns 0 if it succeeded; a nonzero number if it failed to schedule the deletion. for a list of possible values, see return codes. ...
deleteValue - Archive of obsolete content
ary key. method of winreg object syntax int deletevalue ( string subkey, string valname); parameters the deletevalue method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair you want to remove. returns 0 if it succeeded; a nonzero number if it failed to schedule the deletion. ...
setValue - Archive of obsolete content
arameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value a winregvalue object representing the new non-string value. see winregvalue for information about these values. returns 0 if it succeeded; a nonzero number if it failed to schedule the action. for a list of possible values, see return codes. description the setvalue method sets the value of an arbitrary key. use this method if the value you want to set is not a string. if the value is a string, the setvaluestring method is more convenient. ...
setValueNumber - Archive of obsolete content
alname, number value ); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value a number representing the new string value. returns 0 if it succeeded; a nonzero number if it failed to schedule the action. for a list of possible values, see return codes. description the setvaluenumber method sets the value of a key when that value is a number. use this method if the value you want to set is a number. if the value is not a number, use the setvalue or setvaluestring methods instead. ...
setValueString - Archive of obsolete content
( string subkey, string valname, string value); parameters the method has the following parameters: subkey the key path to the appropriate location in the key hierarchy, such as "software\\netscape\\navigator\\mail". valname the name of the value-name/value pair whose value you want to change. value the new string value. returns 0 if it succeeded; a nonzero number if it failed to schedule the action. for a list of possible values, see return codes. description the setvaluestring method sets the value of a key when that value is a string. use this method if the value you want to set is a string. if the value is not a string, use the setvalue method instead. ...
chromemargin - Archive of obsolete content
ach side of the window. the specified string should contain four numbers, separated by commas, indicating the margin in pixels for the top, right, bottom, and left edges of the window, respectively. this value may be -1 to use the default margin for that side on the current platform, 0 to have no system border (that is, to extend the client area to the edge of the window), or a value greater than zero to indicate how much less than the default default width you wish the margin on that side to be. if this value turns out to be less than 0, 0 is used. ...
minresultsforpopup - Archive of obsolete content
this can be used to display additional items that are not autocomplete results. ...
persistence - Archive of obsolete content
« xul reference home persistence type: integer the persistence may be set to a non-zero value so that the notificationbox's removetransientnotifications method does not remove them. this may be used to close a set of notifications as a group without affecting other notifications. ...
textbox.minResultsForPopup - Archive of obsolete content
« xul reference home minresultsforpopup obsolete since gecko 1.9.1 type: integer the minimum number of results that must be returned for the popup to be displayed. the default value is 1. a zero value will always open the popup unless the textbox is empty. this can be used to display additional items that are not autocomplete results. as of gecko 1.9.1, this attribute is now always specified in lower case. ...
command - Archive of obsolete content
Archive › Mozilla › XUL › Events › command
t in the dom tree). type read only domstring the type of event. bubbles read only boolean whether the event normally bubbles or not cancelable read only boolean whether the event is cancellable or not? view read only windowproxy document.defaultview (window of the document) detail read only long (float) unused; always zero. sourceevent read only event the activation event that caused this command event to be generated. currently only set when a command event is redirected though use of the command attribute. ctrlkey read only boolean true if the control key was down when the event was fired. false otherwise. shiftkey read only boolean true if the shift key was down wh...
getIndexOfItem - Archive of obsolete content
« xul reference home getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. ...
getSelectedItem - Archive of obsolete content
...
OpenClose - Archive of obsolete content
ment, aligned along the top edge of both. this may be confusing to understand, so see positioning a popup which describes this process in more detail and provides images which show the possible values and how a popup would be aligned for each value. the third and fourth arguments to openpopup are x and y offsets. after the popup is positioned, you can further position the popup by specifying non-zero values for these offsets. this allows the position of the popup to be precisely controlled while still being anchored to a specific element. you can use positive values to adjust the popup to the right or downwards and negative values to adjust the popup to the left or upwards. in the following example, the popup is anchored below an element, yet is offset by 10 pixels to the right and 2 pixels ...
textbox (Toolkit autocomplete) - Archive of obsolete content
e: integer the number of rows to show in the results list at a time. a scrollbar will appear so the user can scroll through the remaining items. minresultsforpopup new in thunderbird 3requires seamonkey 2.0 type: integer the minimum number of results that must be returned for the popup to be displayed. the default value is 1. new in thunderbird 3requires seamonkey 2.0 a zero value will always open the popup. this can be used to display additional items that are not autocomplete results. nomatch type: boolean this attribute will be set to true if the last search resulted in no matches. overview an onchange attribute is an event listener to the object for the event change. a change event is fired in different ways for different xul input elements as list...
The Joy of XUL - Archive of obsolete content
ually unchanged. porting xul applications to other platforms is trivial.the calendar originated as a linux application with no consideration given to porting it to other platforms. but later, when the original developer (oeone corporation) contributed the source to the mozilla project, the calendar had to be migrated to the windows and macintosh platforms. the ui for the xul application required zero porting effort because it worked with almost no alteration on both new platforms. similarly, since the ui code is written in javascript, the interaction logic worked with no effort. however, since the libical library is written in c, more significant effort was required to migrate this component to the other platforms. fortunately, an implementation of the libical library was already available f...
Creating a Skin - Archive of obsolete content
two rules change the normal tab appearance, the first sets the rounding on the first tab and the second sets the rounding on the last tab. used here is a special mozilla style rule, -moz-border-radius, that creates rounded border corners. the upper left border of the first tab and the upper right border of the second tab are rounded by four pixels and the other corners have a round corner of zero pixels, which is equivalent to no rounding. increase the values here for more rounding and decrease them for a more rectangular look. the last rule only applies to tabs that have their selected attribute set to true. it makes the text in the selected tab appear bold, underlined and dark blue. note in the image that this style has applied only to the first tab, because it's the selected one. add...
Creating an Installer - Archive of obsolete content
function donefn() which will be called when the install is complete. you can name the function whatever you like of course. this function has two arguments. the first is the name of the package that was just installed. this is important if you are installing multiple components. the second argument is a result code. if the result is 0, the installation completed successfully. if the result is non-zero, an error occured and the value is an error code. the function donefn() here just displays an alert box to the user. next, we create an array xpi which will hold the name (calendar) and url (calendar.xpi) of the installer. you can add an additional similar such line for each package you wish to have installed. finally, we call the install function. when this section of script is executed, the f...
Focus and Selection - Archive of obsolete content
ion. the simplest one is to select all of the text in a textbox. this involves using the select method of the textbox. tbox.select(); however, you may wish to select only part of the text. to do this you can use the setselectionrange function. it takes two parameters, the first is the starting character and the second is the character after the last one that you want to have selected. values are zero-based, so the first character is 0, the second is 1 and so on. tbox.setselectionrange(4,8); this example will select the fifth character displayed, as well as the sixth, seventh and eighth. if there were only six characters entered into the field, only the fifth and sixth characters would be selected. no error would occur. if you use the same value for both parameters, the start and end of the s...
Stacks and Decks - Archive of obsolete content
a deck where the content changes. like stacks, the direct children of the deck element form the pages of the deck. if there are three children of the deck element, the deck will have three children. the displayed page of the deck can be changed by setting an selectedindex attribute on the deck element. the index is a number that identifies which page to display. pages are numbered starting from zero. so, the first child of the deck is page 0, the second is page 1 and so on. example 3 : source view <deck selectedindex="2"> <description value="this is the first page"/> <button label="this is the second page"/> <box> <description value="this is the third page"/> <button label="this is also the third page"/> </box> </deck> three pages exist here, the default being the third o...
XUL Changes for Firefox 1.5 - Archive of obsolete content
e, refresh, go-forward, go-back, properties, select-font, select-color, network. <menulist> items in a <menulist> support the description attribute to allow for extra descriptive text to appear beside an item's label. the menulist modification methods appenditem and insertitemat take an extra description argument when creating items this way. <listbox> the removeitemat method was sometime non zero-based due to a bug (bug 236068). this has been fixed in firefox 1.5 and all code depending on this non zero-based behaviour should be changed. <stringbundle> the <stringbundle> element has a strings property which may be used to retrieve an enumeration of all of the strings in the bundle. draggable tabs the tabbrowser now allows the user to rearrange tabs by dragging them. <tabbox> the <tab...
box - Archive of obsolete content
Archive › Mozilla › XUL › box
an orient attribute that is set to horizontal, the child elements are laid out from left to right in the order that they appear in the box. if orient is set to vertical, the child elements are laid out from top to bottom. child elements do not overlap. the default orientation is horizontal. more information is available in the xul tutorial. ...
menu - Archive of obsolete content
Archive › Mozilla › XUL › menu
tener(), replacechild(), setattribute(), setattributenode(), setattributenodens(), setattributens(), setuserdata appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new...
menulist - Archive of obsolete content
penditem( label, value, description ) return type: element creates a new menuitem element and adds it to the end of the menulist. you may optionally set a value and description. the function returns the new item. contains( item ) return type: boolean returns true if the menulist contains the specified menuitem as one of its items. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the new...
notification - Archive of obsolete content
. the position of the image is determined by the dir and orient attributes. label type: string the label that will appear on the element. if this is left out, no text appears. for an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. persistence type: integer the persistence may be set to a non-zero value so that the notificationbox's removetransientnotifications method does not remove them. this may be used to close a set of notifications as a group without affecting other notifications. priority type: integer numeric value that specifies the order in which the notifications appear. should be one of the constants described in the notificationbox's appendnotification method. ...
notificationbox - Archive of obsolete content
removed using a slide transition. removecurrentnotification() return type: no return value remove the current notification. removenotification( item ) return type: element remove a notification, displaying the next one if the removed item is the current one. removetransientnotifications( ) return type: no return value remove only those notifications that have a persistence value of zero, and decrements by one the persistence value of those that have a non-zero value. related elements notification ...
radiogroup - Archive of obsolete content
y set a value. the function returns the newly created element. checkadjacentelement( dir ) return type: no return value deselects the currently selected radio button in the group and selects the one adjacent to it. if the argument dir is true, the next radio button is selected. if it is false, the previous radio button is selected. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the n...
tabs - Archive of obsolete content
Archive › Mozilla › XUL › tabs
previous tab. if the wrap argument is true, the adjustment will wrap around when the first or last tab is reached. appenditem( label, value ) return type: element creates a new item and adds it to the end of the existing list of items. you may optionally set a value. the function returns the newly created element. getindexofitem( item ) return type: integer returns the zero-based position of the specified item. items are numbered starting at the first item displayed in the list. getitematindex( index ) return type: element returns the element that is at the specified index. insertitemat( index, label, value ) return type: element this method creates a new item and inserts it at the specified position. you may optionally set a value. the n...
window - Archive of obsolete content
ach side of the window. the specified string should contain four numbers, separated by commas, indicating the margin in pixels for the top, right, bottom, and left edges of the window, respectively. this value may be -1 to use the default margin for that side on the current platform, 0 to have no system border (that is, to extend the client area to the edge of the window), or a value greater than zero to indicate how much less than the default default width you wish the margin on that side to be. if this value turns out to be less than 0, 0 is used. disablechrome type: boolean set this attribute to true to disable chrome in the window. this is used to hide chrome when showing in-browser ui such as the about:addons page, and causes the toolbars to be hidden, with only the tab strip (and, i...
2006-10-26 - Archive of obsolete content
bug in firefox? an inqury about inaccurate layout for firefox being a bug - shaver suggests its a bug with gecko instead. error building firefox-2.0rc3 on uclinux an error was found about building on uclinux, user googgled the error and suggests that the error found in older versions. no replies yet. ubuntu firefox ua string a user questions ubuntu 6.10 and their firefox's ua string, the zeros seem to be wrong. meetings none this week. authors sara minchella (sara) dave manley (senemanley) back to summary list ...
2006-10-27 - Archive of obsolete content
bug in firefox? an inqury about inaccurate layout for firefox being a bug - shaver suggests its a bug with gecko instead. error building firefox-2.0rc3 on uclinux an error was found about building on uclinux, user googgled the error and suggests that the error found in older versions. no replies yet. ubuntu firefox ua string a user questions ubuntu 6.10 and their firefox's ua string, the zeros seem to be wrong. meetings none this week. authors sara minchella (sara) dave manley (senemanley) back to summary list ...
NPClass - Archive of obsolete content
in mozilla 1.8.*, 2 since mozilla 1.9a1, and 3 since firefox 3.0b1. allocate returns a pointer to a newly allocated npobject. called by npn_createobject() if non-null, otherwise the browser calls malloc(). this function is expected to allocate and return enough storage to hold the npobject that is being created. deallocate called by npn_releaseobject() when an object's reference count reaches zero. if this field is null, free() is called isntead. invalidate called on live objects that belong to a plugin instance that is being destroyed. this call is always followed by a call to the deallocate function, or free(). any attempt to use an invalidated object will result in undefined behavior. hasmethod called by npn_hasmethod() to determine whether or not a specified method exists on a give...
NPP_WriteReady - Archive of obsolete content
aller amount of data if desired or necessary; for example, if only 8k of data is available in a network buffer. if the plug-in is allocating memory for the entire stream at once (an as_file stream), it can return a very large number. because it is not processing streaming data, the browser can pass as much data to the instance as necessary in a single npp_write. if the browser receives a value of zero, the data flow temporarily stops. the browser checks to see if the plug-in can receive data again by resending the data at regular intervals. see also npp_write, npstream, npp ...
NPStream - Archive of obsolete content
lug-in can use to store a pointer to private data associated with the instance; not modified by the browser. ndata browser-private value that can store data associated with the instance; should not be modified by the plug-in. url the url that the data in the stream is read from or written to. end offset in bytes of the end of the stream (equivalent to the length of the stream in bytes). can be zero for streams of unknown length, such as streams returned from older ftp servers or generated "on the fly" by cgi scripts. lastmodified time the data in the url was last modified (if applicable), measured in seconds since 12:00 midnight gmt, january 1, 1970. notifydata used only for streams generated in response to a npn_geturlnotify or npn_posturlnotify request. for these streams, notifydata is...
Using the W3C DOM - Archive of obsolete content
if you want to get the element's inline style settings for left and top as integers, parse the integer from the string by using parseint(). conversely, if you want to set the element's inline style settings for left and top, make sure to construct a string that includes the unit (such as "140px") by appending the unit string to the integer value. css 1 and css 2.x specifications require that non-zero values must be specified with a length unit; otherwise, the css declaration will be ignored. mozilla-based browsers, msie 6+, opera 7+ and other w3c standards-compliant browsers enforce such handling of parsing error. css 1 forward-compatible parsing css 2.1 rules for handling parsing errors changing an element's text using the dom the text of an element is available as the textcontent or inn...
Browser Detection and Cross Browser Support - Archive of obsolete content
typeof(document.body.offsetheight) == 'number') { height = document.body.offsetheight; } else if (typeof(window.innerheight) == 'number') { height = window.innerheight; } else { height = 0; } note how the previous example does not make assumptions about which browser is being used. instead, it only tests for the objects which it wishes to use. since the numeric values could potentially be zero, the script tests the type of the objects to make sure they are numbers instead. gecko and navigator 4 gecko is the replacement for navigator 4 rendering engine and as such retains many features from navigator 4. the basic differences between navigator 4 and gecko can be easily summarized by: gecko is standards conformant. gecko supports many more standards than navigator 4 and implements ...
-ms-filter - Archive of obsolete content
' <color> <startcolorstr> = 'startcolorstr=' <color> enabled default: true set to false to disable. endcolor the end color, supports only opaque colors in the #rrggbb notation. endcolorstr the end color, supports both opaque colors (#rrggbb) and colors with alpha opacity using the #aarrggbb notation. gradienttype default: 0 (equivalent to linear-gradient(to bottom, …)) set to a non-zero value to make the gradient horizontal (equivalent to linear-gradient(to right, …)) startcolor the end color, supports only opaque colors in the #rrggbb notation. startcolorstr the end color, supports both opaque colors (#rrggbb) and colors with alpha opacity using the #aarrggbb notation. html <div class="gradient horizontal"></div> <div class="gradient vertical"></div> css html, body...
ArrayBuffer.transfer() - Archive of obsolete content
if newbytelength is undefined, the bytelength of the oldbuffer is used. this operation leaves oldbuffer in a detached state. syntax arraybuffer.transfer(oldbuffer [, newbytelength]); parameters oldbuffer an arraybuffer object from which to transfer. newbytelength the byte length of the new arraybuffer object. return value a new arraybuffer object. ...
Array comprehensions - Archive of obsolete content
be available outside of the comprehension. the input to an array comprehension does not itself need to be an array; iterators and generators can also be used. even strings may be used as input; to achieve the filter and map actions (under array-like objects) above: var str = 'abcdef'; var consonantsonlystr = [for (c of str) if (!(/[aeiouaeiou]/).test(c)) c].join(''); // 'bcdf' var interpolatedzeros = [for (c of str) c + '0' ].join(''); // 'a0b0c0d0e0f0' again, the input form is not preserved, so we have to use join() to revert back to a string. examples simple array comprehensions [for (i of [1, 2, 3]) i * i ]; // [1, 4, 9] var abc = ['a', 'b', 'c']; [for (letters of abc) letters.tolowercase()]; // ["a", "b", "c"] array comprehensions with if statement var years = [1954, 1974, 1990...
VBArray.lbound - Archive of obsolete content
, lbound behaves as if a 1 was passed. example the following example consists of three parts. the first part is vbscript code to create a visual basic safe array. the second part is javascript code that determines the number of dimensions in the safe array and the lower bound of each dimension. since the safe array is created in vbscript rather than visual basic, the lower bound will always be zero. both of these parts go into the <head> section of an html page. the third part is the javascript code that goes in the <body> section to run the other two parts. <head> <script type="text/vbscript"> <!-- function createvbarray() dim i, j, k dim a(2, 2) k = 1 for i = 0 to 2 for j = 0 to 2 a(j, i) = k k = k + 1 next next createvbarray = a end functi...
@set - Archive of obsolete content
internet explorer 11 standards mode and windows 8.x store apps. conditional compilation is supported in internet explorer 10 standards mode and in all earlier versions. the @set statement creates variables used with conditional compilation statements. syntax @set @varname = term parameters varname valid javascript variable name. must be preceded by an "@" character at all times. term zero or more unary operators followed by a constant, conditional compilation variable, or parenthesized expression. remarks numeric and boolean variables are supported for conditional compilation. strings are not. variables created using @set are generally used in conditional compilation statements, but can be used anywhere in javascript code. examples of variable declarations look like this: @se...
New in JavaScript 1.1 - Archive of obsolete content
om() now works on every platform. tostring(): added radix parameter, which specifies the base to use for representing numeric values. isnan() now works on every platform (not only unix anymore) parsefloat() and parseint() now return nan on all platforms, if the first character of the specified string cannot be converted to a number; in previous releases, it returned nan on solaris and irix and zero on all other platforms. ...
Archived JavaScript Reference - Archive of obsolete content
proxy object instead.array.unobserve()the array.unobserve() method was used to remove observers set by array.observe(), but has been deprecated and removed from browsers. you can use the more general proxy object instead.arraybuffer.transfer()the static arraybuffer.transfer() method returns a new arraybuffer whose contents have been taken from the oldbuffer's data and then is either truncated or zero-extended by newbytelength. if newbytelength is undefined, the bytelength of the oldbuffer is used. this operation leaves oldbuffer in a detached state.date.prototype.tolocaleformat()the non-standard tolocaleformat() method converts a date to a string using the specified formatting. intl.datetimeformat is an alternative to format dates in a standards-compliant way. see also the newer version of da...
JavaArray - Archive of obsolete content
in or passed to javascript. javaarray is a wrapper for the instance; all references to the array instance are made through the javaarray. in javascript 1.4 and later, the componenttype parameter is either a javaclass object representing the type of the array or class object, such as one returned by java.lang.class.forname. in javascript 1.3 and earlier, componenttype must be a class object. use zero-based indexes to access the elements in a javaarray object, just as you do to access elements in an array in java. for example: var javastring = new java.lang.string("hello world!"); var bytearray = javastring.getbytes(); bytearray[0] // returns 72 bytearray[1] // returns 101 any java data brought into javascript is converted to javascript data types. when the javaarray is passed back to java,...
Game promotion - Game development
promoting the game helps a lot when monetizing it later on too, so it's important to do it correctly. ...
Publishing games - Game development
rketplaces, and submitting it to closed ones like google play or the ios app store. game promotion developing and finishing the game is not enough. you have to let the world know that you have made something interesting available, which people will enjoy playing. there are many game promotion techniques — many of them free — so even if you're struggling to make a living as an indie dev with zero budget you can still do a lot to let people know about your great new game. promoting the game helps a lot in monetizing it later on too, so it's important to do it effectively. game monetization when you spend your time building, publishing and promoting your game, you will at some point consider earning money out of it. game monetization is essential to anyone who considers their game develop...
Building up a basic demo with PlayCanvas editor - Game development
s to the update() function: this.timer += dt; this.entity.setlocalscale(1, math.abs(math.sin(this.timer)), 1); the setlocalscale() method applies the given values to the x, y and z axes of the object. in our case we're modifying the scale of the cylinder on the y axis, giving it as a value the math.sin() of the timer, with math.abs() applied to the result of that to have the values always above zero (0-1; sin values are normally between -1 and 1.) this gives us a nice scaling effect as a result. remember to add the cylinderanimation.js file to the cylinder object to apply the given animations. the cone time to play with the last object — the cone. create a coneanimation.js file and double click it to open it in the editor. next, add the following line to the initialize() function: thi...
Audio for Web games - Game development
n is pressed. to prime audio like this we want to play a part of it; for this reason it is useful to include a moment of silence at the end of your audio sample. jumping to, playing, and then pausing that silence will mean we can now use javascript to play that file at arbitrary points. you can find out more about best practises with the autoplay policy here. note: playing part of your file at zero volume could also work if the browser allows you to change volume (see below). also note that playing and immediately pausing your audio does not guarantee that a small piece of audio won't be played. note: adding a web app to your mobile's homescreen may change its capabilities. in the case of autoplay on ios, this appears to be the case currently. if possible, you should try your code on sev...
Bounce off the walls - Game development
, on every frame, whether the ball is touching the top edge of the canvas — if yes, we'll reverse the ball movement so it will start to move in the opposite direction and stay within the visible boundaries. remembering that the coordinate system starts from the top left, we can come up with something like this: if(y + dy < 0) { dy = -dy; } if the y value of the ball position is lower than zero, change the direction of the movement on the y axis by setting it equal to itself, reversed. if the ball was moving upwards with a speed of 2 pixels per frame, now it will be moving "up" with a speed of -2 pixels, which actually equals to moving down at a speed of 2 pixels per frame. the code above would deal with the ball bouncing off the top edge, so now let's think about the bottom edge: if(...
Mouse controls - Game development
dth/2; } } in this function we first work out a relativex value, which is equal to the horizontal mouse position in the viewport (e.clientx) minus the distance between the left edge of the canvas and left edge of the viewport (canvas.offsetleft) — effectively this is equal to the distance between the canvas left edge and the mouse pointer. if the relative x pointer position is greater than zero and lower than the canvas width, the pointer is within the canvas boundaries, and the paddlex position (anchored on the left edge of the paddle) is set to the relativex value minus half the width of the paddle, so that the movement will actually be relative to the middle of the paddle. the paddle will now follow the position of the mouse cursor, but since we're restricting the movement to the si...
Animations and tweens - Game development
to the end, we use the add.tween() method, specifying brick.scale as the argument as this is what we want to tween. the to() method defines the state of the object at the end of the tween. it takes an object containing the chosen parameter's desired ending values (scale takes a scale value, 1 being 100% of size, 0 being 0% of size, etc.), the time of the tween in ...
Physics - Game development
nction create() { game.physics.startsystem(phaser.physics.arcade); ball = game.add.sprite(50, 50, 'ball'); game.physics.enable(ball, phaser.physics.arcade); ball.body.velocity.set(150, 150); } function update() { } try reloading index.html again — the ball should now be moving constantly in the given direction. at the moment, the physics engine has gravity and friction set to zero. adding gravity would result in the ball falling down while friction would eventually stop the ball. fun with physics you can do much more with physics, for example by adding ball.body.gravity.y = 100; you will set the vertical gravity of the ball. as a result it will be launched upwards, but then fall due to the effects of gravity pulling it down. this kind of functionality is just the tip of...
Falsy - MDN Web Docs Glossary: Definitions of Web-related terms
a falsy (sometimes written falsey) value is a value that is considered false when encountered in a boolean context. javascript uses type conversion to coerce any value to a boolean in contexts that require it, such as conditionals and loops. there are 8 falsy values: false the keyword false 0 the number zero -0 the number negative zero 0n bigint, when used as a boolean, follows the same rule as a number. 0n is falsy. "" empty string value null null - the absence of any value undefined undefined - the primitive value nan nan - not a number objects are falsy if and only if they have the [[ishtmldda]] internal slot. this slot only exists in document.all and cannot be set usi...
NaN - MDN Web Docs Glossary: Definitions of Web-related terms
practically speaking, if i divide two variables in a javascript program, the result may be nan, which is predefined in javascript as "undefined". hence this division may break the program. ...
Whitespace - MDN Web Docs Glossary: Definitions of Web-related terms
r can be changed by the white-space css property. they are also used as a separator of an element name and its parameters, class names, and so on. in javascript ecmascript® 2015 language specification specifies several unicode codepoints as white space: u+0009 character tabulation <tab>, u+000b line tabulation <vt>, u+000c form feed <ff>, u+0020 space <sp>, u+00a0 no-break space <nbsp>, u+feff zero width no-break space <zwnbsp> and other category “zs” any other unicode “separator, space” code point <usp>. these characters are usually unnecessary for the functionality of the code. ...
Array - MDN Web Docs Glossary: Definitions of Web-related terms
an array is an ordered collection of data (either primitive or object depending upon the language). arrays are used to store multiple values in a single variable. this is compared to a variable that can store only one value. each item in an array has a number attached to it, called a numeric index, that allows you to access it. in javascript, arrays start at index zero and can be manipulated with various methods. what an array in javascript looks like: let myarray = [1, 2, 3, 4]; let catnamesarray = ["jacqueline", "sophia", "autumn"]; //arrays in javascript can hold different types of data, as shown above. learn more general knowledge array on wikipedia technical reference javascript array on mdn ...
Styling lists - Learn web development
value the value attribute allows you to set your list items to specific numerical values. the following example: <ol> <li value="2">toast pita, leave to cool, then slice down the edge.</li> <li value="4">fry the halloumi in a shallow, non-stick pan, until browned on both sides.</li> <li value="6">wash and chop the salad.</li> <li value="8">fill pita wit...
Choosing the right approach - Learn web development
ll support 10prefixed prefixed implemented with the vendor prefix: webkitedge full support 12firefox full support 23notes full support 23notes notes callback parameter is a domhighrestimestamp. this means ten microsecond precision and zero time as performance.now(). no support 11 — 42prefixed notes prefixed implemented with the vendor prefix: moznotes callback parameter is a domtimestamp. this means millisecond precision and zero time as date.now(). no support 4 — 11prefixed notes prefixed implemented with the vendor prefix: moznotes could be called with no input parameters.ie...
Making decisions in your code — conditionals - Learn web development
a common mistake when using the logical or operator in conditional statements is to try to state the variable whose value you are checking once, and then give a list of values it could be to return true, separated by || (or) operators. for example: if (x === 5 || 7 || 10 || 20) { // run my code } in this case the condition inside if(...) will always evaluate to true since 7 (or any other non-zero value) always evaluates to true. this condition is actually saying "if x equals 5, or 7 is true — which it always is". this is logically not what we want! to make this work you've got to specify a complete test either side of each or operator: if (x === 5 || x === 7 || x === 10 ||x === 20) { // run my code } switch statements if...else statements do the job of enabling conditional code wel...
Third-party APIs - Learn web development
e) { if(pagenumber > 0) { pagenumber--; } else { return; } fetchresults(e); }; the first function is simple — we increment the pagenumber variable, then run the fetchresults() function again to display the next page's results. the second function works nearly exactly the same way in reverse, but we also have to take the extra step of checking that pagenumber is not already zero before decrementing it — if the fetch request runs with a minus page url parameter, it could cause errors. if the pagenumber is already 0, we simply return out of the function, to avoid wasting processing power (if we are already at the first page, we don't need to load the same results again). note: you can find our finished nytimes api example code on github (also see it running live her...
Video and Audio APIs - Learn web development
tyle.width = barlength + 'px'; } this is a fairly long function, so let's go through it step by step: first of all, we work out the number of minutes and seconds in the htmlmediaelement.currenttime value. then we initialize two more variables — minutevalue and secondvalue. the two if statements work out whether the number of minutes and seconds are less than 10. if so, they add a leading zero to the values, in the same way that a digital clock display works. the actual time value to display is set as minutevalue plus a colon character plus secondvalue. the node.textcontent value of the timer is set to the time value, so it displays in the ui. the length we should set the inner <div> to is worked out by first working out the width of the outer <div> (any element's clientwidth proper...
Storing the information you need — Variables - Learn web development
'bob', 'jim']; let mynumberarray = [10, 15, 40]; once these arrays are defined, you can access each value by their location within the array. try these lines: mynamearray[0]; // should return 'chris' mynumberarray[2]; // should return 40 the square brackets specify an index value corresponding to the position of the value you want returned. you might have noticed that arrays in javascript are zero-indexed: the first element is at index 0. you'll learn a lot more about arrays in a future article. objects in programming, an object is a structure of code that models a real-life object. you can have a simple object that represents a box and contains information about its width, length, and height, or you could have an object that represents a person, and contains data about their name, heig...
Getting started with Svelte - Learn web development
urce code. having a look at our first svelte component components are the building blocks of svelte applications. they are written into .svelte files using a superset of html. all three sections — <script>, <styles>, and markup — are optional, and can appear in any order you like. <script> // logic goes here </script> <style> /* styles go here */ </style> <!-- markup (zero or more html elements) goes here --> note: for more information on the component format, have a look at the svelte documentation. with this in mind, let's have a look at the src/app.svelte file that came with the starter template. you should see something like the following: <script> export let name; </script> <main> <h1>hello {name}!</h1> <p>visit the <a href="https://svelte.dev/tuto...
Command line crash course - Learn web development
...
Deploying our app - Learn web development
— an exit signal of 0. if there's a failure the test fails with an exit code of 1 — this is a system-level value that says "something failed". the npm run test command will use node to run all the files that are in the tests directory that end with .js. in our build script, npm run test is called, then you see the string && — this means "if the thing on the left succeeded (exited with zero), then do this thing on the right". so this translates into: if the tests pass, then build the code. you'll have to upload your new code to github, using similar commands to what you used before: git add . git commit -m ‘adding test’ git push github master in some cases you might want to test the result of the built code (since this isn't quite the original code we wrote), so the ...
Gecko info for Windows accessibility vendors
tion containers along with the event_focus as selection/focus move together in that case. event_selectionwithin is fired on multi selection containers when the current selection changes within. in addition, event_selectionadd and event_selectionremove are fired on the the child who's selection changed. how to track where the event happened, within your own offscreen model ordinary zero-indexed child ids are not practical for representing events. the problem is that the child id system that is used by msaa doesn't work well when you have a deep tree of objects in a window. it would be impractical to number all of the nodes in a document starting at 0, because whenever a node is inserted or removed it would be computationally very expensive to renumber things. so, the firefox chi...
Choosing the right memory allocator
ocators within nspr or the security code located in the /security/ subtree of the source code. avoid using them elsewhere. ...
Creating JavaScript callbacks in components
...
Error codes returned by Mozilla APIs
ns_error_xpath_parse_failure (0x80600002) ns_error_xpath_unknown...
HTML parser threading
hed straight to the tree op executor and the tree op stage is set as the tree op sink for the tree builder. the executor is told that it's reading from the stage again. if the speculation failed, the first buffer corresponding to the starting point of the speculation gets its start index restored to the index stored on the speculation object. subsequent buffers get their start index reset back to zero. the tokenizer gets its line number restored from the speculation object. this is equivalent to rewinding the input to where it was when speculation started. all the speculations in the speculation queue are destroyed. pending tree ops in the tree builder are cleared. the tree op stage is set as the tree op sink for the tree builder. the executor is told that it's reading from the stage again. th...
Gecko's "Almost Standards" Mode
triggering "almost standards" the doctypes that will trigger "almost standards" mode are those which contain: the public identifier "-//w3c//dtd xhtml 1.0 transitional//en" the public identifier "-//w3c//dtd xhtml 1.0 fr...
HTTP Cache
intermediate memory caching of frequently used metadata (a.k.a. disk cache memory pool) this is a description of this feature status that is currently only a patch in bug 986179. current behavior is simpler and causes a serious memory consumption regression (bug 975367). for the disk cache entries we keep some of the most recent and most used cache entries' meta data in memory for immediate zero-thread-loop opening. the default size of this meta data memory pool is only 250kb and is controlled by a new browser.cache.disk.metadata_memory_limit preference. when the limit is exceeded, we purge (throw away) first expired and then least used entries to free up memory again. only cacheentry objects that are already loaded and filled with data and having the 'consumer reference == 0' (bug 942...
How to add a build-time test
e: cppsrcs, simple_programs, run_test_program. xpcshell tests here are the simple guidelines for adding an xpcshell test to the build system. for now, enclose your test-related code (in the makefile) with ifdef enable_tests run the test program from the "check" target in the makefile. (example to run the testcookie program) in the test program: if the test fails, exit with a non-zero status and/or print the string "fail" to stdout if the test passes, exit with a zero status and don't print the string "fail" (bonus points for printing "pass" :) ) write the test so that you expect it to pass on all platforms, since if the test fails, the tree will go orange (once we've set this up - see bug 352240 for status). for example, to add an xpcshell test to a module, do...
DeferredTask.jsm
bsolete since gecko 28 cancel any pending task. void cancel(); arm request the execution of the task after the delay specified on construction. multiple calls don't introduce further delays. if the task is running, the delay will start when the current execution finishes. the task will always be executed on a different tick of the event loop, even if the delay specified on construction is zero. multiple "arm" calls within the same tick of the event loop are guaranteed to result in a single execution of the task. by design, this method doesn't provide a way for the caller to detect when the next execution terminates, or collect a result. in fact, doing that would often result in duplicate processing or logging. if a special operation or error logging is needed on completion, it can be ...
DownloadSummary
whether all the downloads are currently stopped. progresstotalbytes read only number indicates the total number of bytes to be transferred before completing all the downloads that are currently in progress. for downloads that do not have a known final size, the number of bytes currently transferred is reported as part of this property. this is zero if no downloads are currently in progress. progresscurrentbytes read only number number of bytes currently transferred as part of all the downloads that are currently in progress. this is zero if no downloads are currently in progress. methods bindtolist() this method may be called once to bind this object to a downloadlist. vie...
DownloadTarget
xistence of the file in order to reduce io overhead. path read only string the path of the target file. partfilepath read only string the path of the ".part" file containing the data downloaded so far, or null to disable the use of a ".part" file to keep partially downloaded data. size read only number the size of the target file, in bytes, or zero if the download has not yet been completed. it is possible for this property to have a non-zero value even if the target file no longer exists, if the value is available in download metadata. if that metadata is no longer available and the file has been deleted, then this value is zero. for single-file downloads, this property's value will always match the actual size of the file on dis...
NetUtil.jsm
rns the nsiuri object representing the specified target. exceptions thrown this method throws an exception with the message "must have a non-null string spec or nsifile object" and result code ns_error_invalid_arg if aspec is null. readinputstreamtostring() reads a given number of bytes from an input stream, returning a string containing those bytes. this works even if some of those bytes are zeros, instead of terminating the string at the first zero byte. string readinputstreamtostring( ainputstream, acount, aoptions ); parameters ainputstream the input stream from which to read the data. acount the number of bytes to read from the stream. you can call nsiinputstream.available() to get the number of bytes currently available. aoptions specifies additional options to contr...
Localization: Frequently asked questions
ed documentation about localization in general, see our localization page. how do i preserve whitespace in an entity? do you really want to preserve whitespace or are you looking for a no-break space, you can add that via a &ua0; or \ua0 to dtd and properties files, resp. how can i not display a variable in a .properties entry? you can simply format the value to be of zero width, i.e., use %1$0.s ...
Mozilla Framework Based on Templates (MFBT)
> standard header is not available on all platforms and so cannot be used directly. this header also provides a useful "hook" for embeddings that must customize the types underlying the fixed-size integer types.) types.h includes standardinteger.h and further provides size_t. checkedint.h implements checked integers. they behave like integers, but safely check for integer overflow and divide-by-zero. useful for input validation. floatingpoint.h provides various operations for examining and working upon double-precision floating point values, and for producing various special floating point values. core types.h further provides macros to define imported and exported c symbols. attributes.h implements various function and class attribute macros. the function macros control inlining, note w...
Mozilla Quirks Mode Behavior
ption when written in june 2001, but it no longer appears correct. i don't follow the code in nscssrenderingborders well enough to tell, though.] in quirks mode a fixed width specified on a table cell resets the nowrap attribute. if the nowrap attribute is present the cell width will never be smaller than the specified fixed width (bug 277232). in quirks mode, tables with no rows/rowgroups have zero height even when a height is specified (bug 241161). something about the overhanging border (i.e., the half of the border that's outside the border-box) in border-collapse tables differs between quirks mode and standards mode. [see nstableframe::getdeflationforbackground and figure out what really differs, and when it started differing.] gecko had bug 248239, where table cells acted as they had...
JS::PerfMeasurement
nstance to start timing. void stop() and call this to stop timing again. the counter variables do not update in real time; they only change when stop is called. counter values are accumulated across many start/stop cycles, and you can modify their values if you want; stop simply adds counts read back from the os to whatever is already in each counter. void reset() resets all enabled counters to zero. uint64 cpu_cycles, uint64 instructions, etc. each potentially-measurable event corresponds to a regular old instance variable, which you can read and even modify. all presently-measurable events are measured with counters, not timers; that is, there is no defined relation between the numbers you get from this interface, and wall-clock time. perfmeasurement* js::extractperfmeasurement(jsval wrap...
Measuring performance using the PerfMeasurement.jsm code module
cording. this lets us record information only for the specific code section we want to measure. since we enable monitoring immediately before calling code_to_be_benchmarked(), and disable it as soon as it returns, the code in set_up_some_state() and clean_up_afterward() is not measured. the monitor object automatically accumulates counts over start/stop cycles (that is, it doesn't automatically zero the counters each time you start recording). when you're done benchmarking, you can read out each of the counters you asked for as properties: let report = "cpu cycles: " + monitor.cpu_cycles + "\n" + "cache refs: " + monitor.cache_references + "\n" + "cache misses: " + monitor.cache_misses + "\n"; monitor.reset(); alert(report); the reset() method clears all of th...
Memory reporting
multiple entities and summing their measurements. for example: void foobar::addsizeofexcludingthis(nsmallocsizeoffun amallocsizeof, size_t *afoosizeout, size_t* abarsizeout) const { *afoosizeout += ...; *abarsizeout += ...; } alternatively, you could create a struct: struct foobarsizes { size_t mfoo; size_t mbar; foobarsizes() { mozilla::podzero(this); } } void foobar::addsizeofexcludingthis(nsmallocsizeoffun amallocsizeof, foobarsizes* asizes) const { asizes->mfoo += ...; asizes->mbar += ...; } note the add prefix that makes this incrementing behaviour clear. obviously, if you increment you have to zero the values at some point. when using a struct, its constructor is the obvious place for this.
Profiling with the Firefox Profiler
aries or drivers. tagging is done by adding macros of the form auto_profiler_label("namespace", "name"). these add raii helpers, which are used by the profiler to track entries/exits of the annotated functions. for this to be effective, you need to liberally use auto_profiler_label throughout the code. see geckoprofiler.h for more variations like auto_profiler_label_dynamic. because of the non-zero overhead of the instrumentation, the sample label shouldn't be placed inside hot loops. a profile reporting that a large portion is spent in "unknown" code indicates that the area being executed doesn't have any sample labels. as we focus on using this tool and add additional sample labels coverage should improve. sharing, saving and loading profiles after capturing and viewing a profile you ...
perf
easier to understand. energy estimates perf can access the intel rapl energy estimates. the following example shows how to invoke it for this purpose. sudo perf stat -a -r 1 \ -e "power/energy-pkg/" \ -e "power/energy-cores/" \ -e "power/energy-gpu/" \ -e "power/energy-ram/" \ <command> the -a is necessary; it means "all cores", and without it all the measurements will be zero. the -r 1 means <command> is executed once; higher values can be used to get variations. the output will look like the following. performance counter stats for 'system wide': 51.58 joules power/energy-pkg/ [100.00%] 14.80 joules power/energy-cores/ [100.00%] 9.93 joules power/energy-gpu/ [100.00%] 27.38 joules power/energy-ram/ [100.00%] 5.003049064 seconds time ela...
AsyncTestUtils extended framework
dom recipient. to: (automatically generated single recipient) a list of recipients, where each recipient is a list whose first element is a (display) name and second element is an email address. for example, {to: [["john doe", "john_doe@example.com"], ["john smith", "smitty@example.com"]]} would specify two recipients. cc: (none) a list of recipients like 'to', but in this case the default is zero recipients. from: (automatically generated) a list whose first element is a (display) name and second element is an email address. for example, {count: 4, from: ["john doe", "john_doe@example.com"]} would result in four messages from john doe to random recipients. synthetic message sets the code that creates synthetic message sets returns instances of the syntheticmessageset class. this clas...
Monitors
as many times as it sees fit. the first time the thread enters a monitor, it acquires the monitor's lock and the thread's entry count is incremented to 1. each subsequent time the thread successfully enters the same monitor, the thread's entry count is incremented again, and each time the thread exits the monitor, the thread's entry count is decremented. when the entry count for a thread reaches zero, the thread releases the monitor's lock, and other threads that were blocked while trying to enter the monitor will be rescheduled. a call to pr_wait temporarily returns the entry count to zero. when the calling thread resumes, it has the same entry count it had before the wait operation. unlike a mutex of type prlock, a mutex of type prmonitor has a single, implicitly associated condition vari...
NSPR LOG MODULES
special log module names are provided for controlling nspr's log service at execution time. these controls should be set in the nspr_log_modules environment variable at execution time to affect nspr's log service for your application. all the name all enables all log modules. to enable all log module calls to pr_log, set the variable a...
PLHashComparator
plhashcomparator defines the meaning of equality for the unspecified type. for convenience, two comparator functions are provided. ...
PL_strdup
r *s); parameter the function has a single parameter: s the string to copy, may be null. returns the function returns one of these values: if successful, a pointer to a copy of the specified string. if the memory allocation fails, null. description to accommodate the terminator, the size of the allocated memory is one greater than the length of the string being copied. a null argument, like a zero-length argument, results in a pointer to a one-byte block of memory containing the null value. notes the memory allocated by pl_strdup should be freed with pl_strfree. ...
PRCallOnceType
structure for tracking initialization. syntax #include <prinit.h> typedef struct prcalloncetype { printn initialized; print32 inprogress; prstatus status; } prcalloncetype; fields the structure has these fields: initialized if not zero, the initialization process has been completed. inprogress if not zero, the initialization process is currently being executed. calling threads that observe this status block until inprogress is zero. status an indication of the outcome of the initialization process. description the client is responsible for initializing the prcalloncetype structure to all zeros. this initialization must be accomplished before any threading issues exist. ...
PRErrorCode
be retrieved with pr_geterror. you can also set your own errors using pr_seterror. syntax #include <prerror.h> typedef print32 prerrorcode description the service nspr offers in this area is the ability to associate a thread-specific condition with an error number. the error number namespace is not well managed. nspr assumes error numbers starting at -6000 (decimal) and progressing towards zero. at present less than 100 error codes have been defined. if nspr's error handling is adopted by calling clients, then some sort of partitioning of the namespace will have to be employed. nspr does not attempt to address this issue. for nspr errors, see error codes. ...
PRLinger
set to pr_false, pr_close returns immediately, but if there are any data remaining in the socket send buffer, the runtime attempts to deliver the data to the peer. if polarity is set to pr_true and linger is set to 0 (pr_interval_no_wait), the runtime aborts the connection when it is closed and discards any data remaining in the socket send buffer. if polarity is set to pr_true and linger is nonzero, the runtime lingers when the socket is closed. that is, if any data remains in the socket send buffer, pr_close blocks until either all the data is sent and acknowledged by the peer or the interval specified by linger expires. ...
PR_ASSERT
terminates execution when a given expression is false. syntax #include <prlog.h> void pr_assert ( expression ); parameters the macro has this parameter: expression any valid c language expression that evaluates to true or false. returns nothing description this macro evaluates the specified expression. when the result is zero (false) the application terminates; otherwise the application continues. the macro converts the expression to a string and passes it to pr_assert, using file and line parameters from the compile-time environment. this macro compiles to nothing if compile-time options are not specified to enable logging. ...
PR_Calloc
syntax #include <prmem.h> void *pr_calloc ( pruint32 nelem, pruint32 elsize); parameters nelem the number of elements of size elsize to be allocated. elsize the size of an individual element. returns an untyped pointer to the allocated memory, or if the allocation attempt fails, null. call pr_geterror() to retrieve the error returned by the libc function malloc(). description this function allocates memory on the heap for the specified number of objects of the specified size. all bytes in the allocated memory are cleared. ...
PR_CExitMonitor
...
PR_CLIST_IS_EMPTY
checks for an empty circular list. syntax #include <prclist.h> printn pr_clist_is_empty (prclist *listp); parameter listp a pointer to the linked list. description pr_clist_is_empty returns a non-zero value if the specified list is an empty list, otherwise returns zero. ...
PR_CallOnce
from that time on, the client should consider the object read-only (or even opaque) and allow the runtime to manipulate its content appropriately. ...
PR_CreateThread
g the thread local (pr_local_thread), global (pr_global_thread) or global bound (pr_global_bound_thread). however, nspr may override this preference if necessary. state specifies whether the thread is joinable (pr_joinable_thread) or unjoinable (pr_unjoinable_thread). stacksize specifies your preference for the size of the stack, in bytes, associated with the newly created thread. if you pass zero in this parameter, pr_createthread chooses the most favorable machine-specific stack size. returns the function returns one of the following values: if successful, a pointer to the new thread. this pointer remains valid until the thread returns from its root function. if unsuccessful, (for example, if system resources are unavailable), null. description if you want the thread to start u...
PR_EnumerateHostEnt
f the possible addresses of a prhostent structure, acquired from pr_gethostbyname or pr_gethostbyaddr. syntax #include <prnetdb.h> printn pr_enumeratehostent( printn enumindex, const prhostent *hostent, pruint16 port, prnetaddr *address); parameters the function has the following parameters: enumindex the index of the enumeration. to begin an enumeration, this argument is set to zero. to continue an enumeration (thereby getting successive addresses from the host entry structure), the value should be set to the function's last returned value. the enumeration is complete when a value of zero is returned. hostent a pointer to a prhostent structure obtained from pr_gethostbyname or pr_gethostbyaddr. port the port number to be assigned as part of the prnetaddr structure. this ...
PR_ExitMonitor
decrements the entry count associated with a specified monitor and, if the entry count reaches zero, releases the monitor's lock. syntax #include <prmon.h> prstatus pr_exitmonitor(prmonitor *mon); parameter the function has the following parameter: mon a reference to an existing structure of type prmonitor. the monitor object referenced must be one for which the calling thread currently holds the lock. returns the function returns one of the following values: if successful, pr_success. if unsuccessful (the calling thread has not entered the monitor), pr_failure. description if the decremented entry count is zero, pr_exitmonitor releases the monitor's lock. threads that were blocked trying to enter the monitor will be rescheduled. ...
PR_GMTParameters
t. returns a time parameters structure that expresses the time zone offsets at the specified time. description this is a frequently-used time parameter callback function. you don't normally call it directly; instead, you pass it as a parameter to pr_explodetime() or pr_normalizetime(). this is a trivial function; for any input, it returns a prtimeparameters structure with both fields set to zero. ...
PR_GetErrorText
...
PR_GetErrorTextLength
gets the length of the error text. syntax #include <prerror.h> print32 pr_geterrortextlength(void) returns if a zero is returned, no error text is currently set. otherwise, the value returned is sufficient to contain the error text currently available. ...
PR_GetRandomNoise
i(prsize) pr_getrandomnoise( void *buf, prsize size ); parameters the function has these parameters: buf a pointer to a caller-supplied buffer to contain the generated random number. buf must be at least as large as specified in size. size the size, in bytes, of the requested random number. returns prsize value equal to the size of the random number actually generated, or zero. the generated size may be less than the size requested. a return value of zero means that pr_getrandomnoise is not implemented on this platform, or there is no available noise to be returned at the time of the call. description pr_getrandomnoise provides a random value, depending on platform. the length of the random value is dependent on the platform and its ability to provide a random value ...
PR_MSEC_PER_SEC
syntax #include <prtime.h> #define pr_msec_per_sec 1000ul ...
PR_NEWZAP
...
PR_NSEC_PER_MSEC
syntax #include <prtime.h> #define pr_nsec_per_msec 1000000ul ...
PR_NSEC_PER_SEC
syntax #include <prtime.h> #define pr_nsec_per_sec 1000000000ul ...
PR_NewMonitor
...
PR_Recv
ves bytes from a connected socket. syntax #include <prio.h> print32 pr_recv( prfiledesc *fd, void *buf, print32 amount, printn flags, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer to hold the data received. amount the size of buf (in bytes). flags must be zero or pr_msg_peek. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes actually received. the value 0 means the network connection is closed. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr...
PR_RecvFrom
o.h> print32 pr_recvfrom( prfiledesc *fd, void *buf, print32 amount, printn flags, prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data received. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. addr a pointer to the prnetaddr object that will be filled in with the address of the sending peer on return. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes actually received. the value 0 means the network connection is cl...
PR_STATIC_ASSERT
<prlog.h> pr_static_assert ( expression ); parameters the macro has this parameter: expression any valid expression which evaluates at compile-time to true or false. an expression which cannot be evaluated at compile time will cause a compiler error; see pr_assert for a runtime alternative. returns nothing description this macro evaluates the specified expression. when the result is zero (false) program compilation will fail with a compiler error; otherwise compilation completes successfully. the compiler error will include the number of the line for which the compile-time assertion failed. this macro may only be used in locations where an extern function declaration may be used. ...
PR_Send
#include <prio.h> print32 pr_send( prfiledesc *fd, const void *buf, print32 amount, printn flags, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data to be sent. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent. if the parameter fd is a blocking socket, this number must always equal amount. the value -1 indicates a failure. the reason for the failure can be obtained b...
PR_SendTo
2 pr_sendto( prfiledesc *fd, const void *buf, print32 amount, printn flags, const prnetaddr *addr, printervaltime timeout); parameters the function has the following parameters: fd a pointer to a prfiledesc object representing a socket. buf a pointer to a buffer containing the data to be sent. amount the size of buf (in bytes). flags this obsolete parameter must always be zero. addr a pointer to the address of the destination. timeout a value of type printervaltime specifying the time limit for completion of the receive operation. returns the function returns one of the following values: a positive number indicates the number of bytes successfully sent. the value -1 indicates a failure. the reason for the failure can be obtained by calling pr_geterror. des...
PR_SetError
sets error information within a thread context. syntax #include <prerror.h> void pr_seterror(prerrorcode errorcode, print32 oserr) parameters the function has these parameters: errorcode the nspr (platform-independent) translation of the error. oserr the platform-specific error. if there is no appropriate os error number, a zero may be supplied. description nspr does not validate the value of the error number or os error number being specified. the runtime merely stores the value and returns it when requested. ...
PR_SetErrorText
otherwise the text is assumed to be the length specified and to possibly include null characters (as might occur in a multilingual string). text the text to associate with the error. ...
PR_USEC_PER_MSEC
syntax #include <prtime.h> #define pr_usec_per_msec 1000ul ...
PR_USEC_PER_SEC
syntax #include <prtime.h> #define pr_usec_per_sec 1000000ul ...
Running NSPR tests
passed concur passed cvar passed cvar2 passed ... sprintf failed ... timetest passed tpd passed udpsrv passed vercheck passed version passed writev passed xnotify passed zerolen passed end mon mar 12 11:55:47 pdt 2007 how to determine if the test suite passed if all the tests reported passed as the results, the test suite passed. what if some of the tests crashed or reported failed as the results? it doesn't necessarily mean the test suite failed because some of the test programs are known to fail. until the test failures are f...
An overview of NSS Internals
ically associated to that task are requested from the associated arena. the implementation of arenas makes sure that all individual memory blocks are tracked. once a task is done, regardless whether it completed or was aborted, the programmer simply needs to release the arena, and all individually allocated blocks will be released automatically. often freeing is combined with immediately erasing (zeroing, zfree) the memory associated to the arena, in order to make it more difficult for attackers to extract keys from a memory dump. nss uses many c data structures. often nss has multiple implementations for the same or similar concepts. for example, there are multiple presentations of certificates, and the nss internals (and sometimes even the application using nss) might have to convert betw...
NSS 3.12.4 release notes
r msvc++ bug 490154: cryptokey framework requires module to implement generatekey when they support keypairgeneration bug 491044: remove support for vms (a.k.a., openvms) from nss bug 491174: cert_pkixverifycert reports wrong error code when ee cert is expired bug 491919: cert.h doesn't have valid functions prototypes bug 492131: a failure to import a cert from a p12 file leaves error code set to zero bug 492385: crash freeing named crl entry on shutdown bug 493135: bltest crashes if it can't open the input file bug 493364: can't build with --disable-dbm option when not cross-compiling bug 493693: sse2 instructions for bignum are not implemented on os/2 bug 493912: sqlite3_reset should be invoked in sdb_findobjectsinit when error occurs bug 494073: update rsa/dsa powerupself tests to be compli...
NSS 3.12.5 release_notes
utdown functions see nss.h for details. the 2 new functions are: nss_initcontext nss_shutdowncontext parameters for these functions are used to initialize softoken. these are mostly strings used to internationalize softoken. memory for the strings are owned by the caller, who is free to free them once nss_contextinit returns. if the string parameter is null (as opposed to empty, zero length), then the softoken default is used. these are equivalent to the parameters for pk11_configurepkcs11(). see the following struct in nss.h for details: nssinitparametersstr other new functions in secmod.h: secmod_getskipfirstflag secmod_getdefaultmoddbflag in prlink.h nss_securememcmp port_loadlibraryfromorigin modified functions sgn...
NSS 3.19.1 release notes
3 bits. new in nss 3.19.1 new functionality no new functionality is introduced in this release. this patch release includes a fix for the recently published logjam attack. notable changes in nss 3.19.1 nss reports the bit length of keys more accurately. thus, the seckey_publickeystrength and seckey_publickeystrengthinbits functions could report smaller values for values that have leading zero values. this affects the key strength values that are reported by ssl_getchannelinfo. the minimum size of keys that nss will generate, import, or use has been raised: the minimum modulus size for rsa keys is now 512 bits the minimum modulus size for dsa keys is now 1023 bits the minimum modulus size for diffie-hellman keys is now 1023 bits bugs fixed in nss 3.19.1 this bugzil...
NSS 3.24 release notes
gy (nist) guidance (as of 2015): software integrity checks and post functions are executed on shared library load. these checks have been disabled by default, as they can cause a performance regression. to enable these checks, you must define symbol nss_force_fips when building nss. counter mode and galois/counter mode (gcm) have checks to prevent counter overflow. additional csps are zeroed in the code. nss softoken uses new guidance for how many rabin-miller tests are needed to verify a prime based on prime size. nss softoken has also been updated to allow nss to run in fips level 1 (no password). this mode is triggered by setting the database password to the empty string. in fips mode, you may move from level 1 to level 2 (by setting an appropriate password), but not th...
NSS 3.33 release notes
t parameter. cert_findcertbynicknameoremailaddrcx - a variation of existing function cert_findcertbynicknameoremailaddr that accepts an additional password context parameter. cert_findcertbynicknameoremailaddrforusagecx - a variation of existing function cert_findcertbynicknameoremailaddrforusage that accepts an additional password context parameter. in secport.h nss_securememcmpzero - check if a memory region is all zero in constant time. port_zallocaligned - allocate aligned memory. port_zallocalignedoffset - allocate aligned memory for structs. in ssl.h ssl_getexperimentalapi - access experimental apis in libssl. bugs fixed in nss 3.33 this bugzilla query returns all the bugs fixed in nss 3.33: https://bugzilla.mozilla.org/buglist.cgi?resolution=...
NSS 3.36.5 release notes
a.org for secure https download: source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/nss_3_36_5_rtm/src/ new in nss 3.36.5 new functionality no new functionality is introduced in this release. this is a patch release to fix cve-2018-12384 bugs fixed in nss 3.36.5 bug 1483128 - nss responded to an sslv2-compatible clienthello with a serverhello that had an all-zero random (cve-2018-12384) compatibility nss 3.36.5 shared libraries are backward compatible with all older nss 3.x shared libraries. a program linked with older nss 3.x shared libraries will work with nss 3.36.5 shared libraries without recompiling or relinking. furthermore, applications that restrict their use of nss apis to the functions listed in nss public functions will remain compatible wit...
NSS 3.39 release notes
a program linked with older nss 3.x shared libraries will work wi...
NSS 3.55 release notes
eplace p384 and p521 with new, verifiable implementations from fiat-crypto and ecckiila. bug 1649487 - move overzealous assertion in vfy_endwithsignature. bug 1631573 (cve-2020-12401) - remove unnecessary scalar padding. bug 1636771 (cve-2020-12403) - explicitly disable multi-part chacha20 (which was not functioning correctly) and more strictly enforce tag length. bug 1649648 - don't memcpy zero bytes (sanitizer fix). bug 1649316 - don't memcpy zero bytes (sanitizer fix). bug 1649322 - don't memcpy zero bytes (sanitizer fix). bug 1653202 - fix initialization bug in blapitest when compiled with nss_disable_deprecated_seed. bug 1646594 - fix avx2 detection in makefile builds. bug 1649633 - add pk11_findcertinslot to search a given slot for a der-encoded certificate. bug 1651520 - f...
NSS API Guidelines
takes discipline not to leak memory, but it simplifies things a lot. also, the implementation of free works (doesn't crash), no matter if from an arena, or the heap, as long as from our allocators. combined with purify, this also helps us catch cases where things being allocated by one allocator are freed by another, which is a common windows pitfall. the security code often wants to be sure to zero memory, when it's being freed; we'll add it to the primitives to deal with. the arena_threadmark preprocessor definition (default in debug builds), and code it encloses, will add some checking for the following situation: thread a marks the arena, and allocates some memory from it. thread b allocates some memory from the arena. thread a releases the arena back to the mark. thread b now fi...
nss tech note7
*). use seckey_destroyprivatekey() to destroy a private key (seckeyprivatekey *). unlike seckeypublickey and seckeyprivatekey, pk11symkey objects are reference counted. use pk11_referencesymkey() to acquire a reference to a symmetric key (pk11symkey *). use pk11_freesymkey() to release a reference to a symmetric key (pk11symkey *); the symmetric key is destroyed when its reference count becomes zero. functions rsa signing and encryption functions are provided by two layers of nss function: the sgn_ and vfy_ functions in cryptohi.h, and the pk11_ functions in pk11pub.h. as a general principle, you should use the highest layer of nss you can possibly use for what you are trying to accomplish. for example, if you just need to generate or verify a signature, you can use the sgn_ and vfy_ fun...
nss tech note8
me = ssl_time(); sid->expirationtime = sid->creationtime + ssl_sid_timeout; (*ss->sec.cache)(sid); for ssl3: sid->lastaccesstime = sid->creationtime = ssl_time(); sid->expirationtime = sid->creationtime + ssl3_sid_timeout; (*ss->sec.cache)(sid); the cache api was defined such that the caller must set creationtime properly, and may set expirationtime to the desired value or to zero. if zero, then the called cache function would compute the correct expiration time by adding the chosen timeout (from one of those two global variables) to the sid's creationtime, giving the expirationtime. however, none of the callers relied on the ability of the respective cache functions to be able to compute the expiration time. all callers computed the expiration times explicitly, as shown...
NSS PKCS11 Functions
unique. minpwlen then minimum password length for this token. flags a comma separated list of flag values, parsed case-insensitive. valid flags are: readonly - databases should be opened read only. nocertdb - don't try to open a certificate database. nokeydb - don't try to open a key database. forceopen - don't fail to initialize the token if thedatabases could not be opened. passwordrequired - zero length passwords are not acceptable(valid only if there is a keydb). optimizespace - allocate smaller hash tables and lock tables.when this flag is not specified, softoken will allocatelarge tables to prevent lock contention. for more info on module strings see pkcs11_module_specs. this function will return a reference to a slot. the caller is responsible for freeing the slot reference when it i...
Python binding for NSS
ory on june 9th 2009. python-nss is currently available in: fedora rhel 6 the principal developer of python-nss is john dennis jdennis@redhat.com. additional contributors are: miloslav trmač mitr@redhat.com bohuslav kabrda slavek@redhat.com the python-nss binding is still young despite having been utilized in several major software projects. thus it's major version number is still at zero. this is primarily so the developers can make changes to the api as experiece grows with it. for example it is already known there are some naming inconsistencies. elments of the api are probably not ideally partitioned into proper namespaces via python modules. some functionality and interface have already been deprecated due to lessons learned. thus at some point in the future when it is felt t...
FC_FindObjects
[out] pointer to location to receive the object handles. usmaxobjectcount [in] maximum number of handles to retrieve. pusobjectcount [out] pointer to location to receive the number of returned handles. description fc_findobjects returns the next set of object handles matching the criteria set up by the previous call to fc_findobjectsinit and sets the object count variable to their number or to zero if there are none. return value examples see also fc_findobjectsinit, nsc_findobjects ...
FC_SetOperationState
len, ck_object_handle hencryptionkey, ck_object_handle hauthenticationkey ); parameters hsession [in] handle of the open session. poperationstate [in] pointer to a byte array containing the operation state. uloperationstatelen [in] contains the total length (in bytes) of the operation state. hencryptionkey [in] handle of the encryption or decryption key to be used in in a stored session or zero if no key is needed. hauthenticationkey [in] handle of the authentication key to be used in the stored session or zero if none is needed. description fc_setoperationstate restores the cryptographic operations state of a session from an array of bytes obtained with fc_getoperationstate. this function only works for digest operations for now. therefore, a user may call fc_setoperationstate witho...
NSS Key Functions
s are shared objects. when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero. the use of the word "destroy" in function names or in the description of a function implies reference counting. never alter the contents of a certificate or key structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. ...
NSS tools : cmsutil
rguments description the cmsutil command-line uses the s/mime toolkit to perform basic operations, such as encryption and decryption, on cryptographic message syntax (cms) messages. to run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options. options and arguments options options specify an action. option arguments modify an action. the options and arguments for the cmsutil command are defined as follows: -d decode a message. -c encrypt a message. -e envelope a message. -o create a certificates-only message. -s sign a message. arguments option arguments modif...
NSS tools : crlutil
e security module database tool. for information on certificate and key database management, see using the certificate database tool. to run the certificate revocation list management tool, type the command crlutil option [arguments] where options and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options, or with the -h option. options and arguments options options specify an action. option arguments modify an action. the options and arguments for the crlutil command are defined as follows: -g create new certificate revocation list(crl).- -d delete certificate revocation list from cert database. -i import a crl...
sslcrt.html
s are shared objects. when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero. the use of the word "destroy" in function names or in the description of a function implies reference counting. never alter the contents of a certificate or key structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. getting certificate information cert_fi...
sslkey.html
s are shared objects. when an application makes a copy of a particular certificate or key structure that already exists in memory, ssl makes a shallow copy--that is, it increments the reference count for that object rather than making a whole new copy. when you call cert_destroycertificate or seckey_destroyprivatekey, the function decrements the reference count and, if the reference count reaches zero as a result, both frees the memory and sets all the bits to zero. the use of the word "destroy" in function names or in the description of a function implies reference counting. never alter the contents of a certificate or key structure. if you attempt to do so, the change affects all the shallow copies of that structure and can cause severe problems. ...
NSS Tools cmsutil
he cmsutil command-line utility uses the s/mime toolkit to perform basic operations, such as encryption and decryption, on cryptographic message syntax (cms) messages. syntax to run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options. options and arguments options specify an action. option arguments modify an action. the options and arguments for the cmsutil command are defined as follows: options -ddecode a message. -c encrypt a message. -e envelope a message. -o create a certificates-only message. -s sign a message. arg...
NSS Tools crlutil
ee using the certificate database tool. availability see the release notes for the platforms this tool is available on. syntax to run the certificate revocation list management tool, type the command crlutil option [arguments] where options and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options, or with the -h option. options and arguments options specify an action and are uppercase. option arguments modify an action and are lowercase. certificate revocation list management tool command options and their arguments are defined as follows: options ...
NSS Tools modutil
t, see using the certificate database tool. availability this tool is known to build on solaris 2.5.1 (sunos 5.5.1) and windows nt 4.0. syntax to run the security module database tool, type the command modutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options. options and arguments options specify an action. option arguments modify an action. the options and arguments for the modutil command are defined as follows: options -create create new secmod.db, key3.db, and cert8.db files. use the -dbdir directory argument to specify a directory. if any of these databases ...
NSS Tools pk12util
lotpassword] [-w p12filepasswordfile | -w p12filepassword] syntax to run the pkcs #12 tool, type ther command pk12util option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. three of the options, -i, -o, and -l, should be considered commands of the pk12util invocation. each command takes several options. options may take zero or more arguments. to see a usage string, issue the pkcs12util command without any options. options and arguments options specify an action. option arguments modify an action. the options and arguments for the pk12util command are defined as follows: options -i p12file import a certificate and private key from from the p12file into the database. -o p12file export certificate and ...
certutil
id of an existing key reuses that key pair (which is required to renew certificates). -l display detailed information when validating a certificate with the -v option. -m serial-number assign a unique serial number to a certificate being created. this operation should be performed by a ca. the default serial number is 0 (zero). serial numbers are limited to integers. -n nickname specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. bracket the nickname string with quotation marks if it contains spaces. -o output-file specify the output file name for new certificates or binary certificate requests. bracket t...
NSS tools : cmsutil
Mozilla › Projects › NSS › tools › cmsutil
the cmsutil command-line uses the s/mime toolkit to perform basic operations, such as encryption and decryption, on cryptographic message syntax (cms) messages. to run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options. options and arguments options options specify an action. option arguments modify an action. the options and arguments for the cmsutil command are defined as follows: -d decode a message. -c encrypt a message. -e envelope a message. -o create a...
NSS tools : crlutil
Mozilla › Projects › NSS › tools › crlutil
ule database tool. for information on certificate and key database management, see using the certificate database tool. to run the certificate revocation list management tool, type the command crlutil option [arguments] where options and arguments are combinations of the options and arguments listed in the following section. each command takes one option. each option may take zero or more arguments. to see a usage string, issue the command without options, or with the -h option. options and arguments options options specify an action. option arguments modify an action. the options and arguments for the crlutil command are defined as follows: -g create new certificate revocation list(crl). -d delete certificate revocation list ...
NSS tools : signtool
cate for the issuer of the object-signing certificate is listed in the certificate database, that the ca's digital signature on the object-signing certificate is valid, that the relevant certificates have not expired, and so on. --verbosity value sets the quantity of information netscape signing tool generates in operation. a value of 0 (zero) is the default and gives full information. a value of -1 suppresses most messages, but not error messages. -w archive displays the names of signers of any files in the archive. -x directory excludes the specified directory from signing. note that with netscape signing tool version 1.1 and later this option can appear mul...
Tutorial: Embedding Rhino
ow to add it to runscript later. (note that because the java -jar option preempts the rest of the classpath, we can't use that and access the counter class.) $ java -cp "js.jar;examples" org.mozilla.javascript.tools.shell.main js> defineclass("counter") js> c = new counter(7) [object counter] js> c.count 7 js> c.count 8 js> c.count 9 js> c.resetcount() js> c.count 0 counter's constructors the zero-argument constructor is used by rhino runtime to create instances. for the counter example, no initialization work is needed, so the implementation is empty. public counter () { } the method jsconstructor defines the javascript constructor that was called with the expression new counter(7) in the javascript code above. public void jsconstructor(int a) { count = a; } class name the class na...
Rhino scopes and contexts
to associate the current thread with a context, simply call the enter method of context: context cx = context.enter(); once you are done with execution, simply exit the context: context.exit(); these calls will work properly even if there is already a context associated with the current thread. that context will be returned and an internal counter incremented. only when the counter reaches zero will it be disassociated from the thread. remember to put the exit() call in a finally block if you're executing code that could throw an exception. scopes a scope is a set of javascript objects. execution of scripts requires a scope for top-level script variable storage as well as a place to find standard objects like function and object. it's important to understand that a scope is independ...
Creating JavaScript jstest reftests
s to expectexitcode will tell the post-processing scripts that the test actually passed if any of the exit codes are found when the test terminates. this approach has limited use, however. in the javascript shell, an uncaught exception or out of memory error will terminate the shell with an exit code of 3. however, an uncaught error or exception will not cause the browser to terminate with a non-zero exit code. to make the situation even more complex, newer c++ compilers will abort the browser with a typical exit code of 5 by throwing a c++ exception when an out of memory error occurs. simply testing the exit code does not allow you to distinguish the variety of causes a particular abnormal exit may have. in addition, some tests pass if they do not crash; however, they may not terminate unle...
Bytecode Descriptions
bytecode listing this document is automatically generated from opcodes.h by make_opcode_doc.py. constants undefined stack: ⇒ undefined push undefined. null stack: ⇒ null push null. false, true stack: ⇒ true/false push a boolean constant. int32 operands: (int32_t val) stack: ⇒ val push the int32_t immediate operand as an int32value. jsop::zero, jsop::one, jsop::int8, jsop::uint16, and jsop::uint24 are all compact encodings for jsop::int32. zero stack: ⇒ 0 push the number 0. one stack: ⇒ 1 push the number 1. int8 operands: (int8_t val) stack: ⇒ val push the int8_t immediate operand as an int32value. uint16 operands: (uint16_t val) stack: ⇒ val push the uint16_t immediate operand as an int32value. uint24 operands: (uint24_t val) stack: ⇒ val push the...
Tracing JIT
an flow from one fragment into another, or back out of generated code and into the interpreter. an assembler is the only component of the tracing jit that reads or writes native code. therefore an assembler contains several machine-specific methods which are implemented in the accompanying nanojit/native*.* files. an assembler runs in a single pass over its input, transforming one lins value to zero or more nins values. it is important to keep in mind that this pass runs backwards from the last lins in the input lir code to the first, generating native code in reverse. running backwards sometimes makes the logic difficult to follow, but it is an essential factor in maintaining the assembler's high speed and small size. in the spidermonkey tracing jit there is only ever one assembler active ...
JSAPI User Guide
js_getprivate(cx, obj); special topics unicode to pass unicode data between javascript and native code, represent the data in utf-16 in memory. javascript strings, property names, and programs are all made up of jschars, which are 16-bit unsigned integers. many jsapi functions operate on null-terminated, 8-bit char strings. these functions convert their char * arguments to 16-bit strings by zero-extending each 8-bit char to 16 bits—unless js_c_strings_are_utf8 is defined or js_setcstringsareutf8 has been called, in which case each char * string is interpreted as utf-8 unicode text. the jsapi provides jschar-based versions of many api functions that operate on strings, object properties, and javascript code. char-based function jschar-based function unicode da...
JS::AutoVectorRooter
this article covers features introduced in spidermonkey 17 base class that roots an internal variable-size array of type t. syntax js::autovectorrooter(jscontext* cx); methods method description size_t length() const returns the length of the array. bool empty() const determines if the array is empty (length is zero). bool append(const t &v) appends an element v to the array. bool append(const t *ptr, size_t len) appends a sequence of t specified with a pointer ptr and length len to the array. bool appendall(const autovectorrooter<t> &other) appends all elements of other to the array. bool insert(t *p, const t &val) inserts an element val at the position specified by p. void infalliblea...
JS::CallArgs
ext *cx, const char *fnname, unsigned required) returns true if there are at least required arguments passed in. if false, it reports an error message on the context. methods inherited from js::callargsbase method description unsigned length() const returns the number of arguments.. js::mutablehandlevalue operator[](unsigned i) const returns the i-th zero-indexed argument. js::handlevalue get(unsigned i) const returns the i-th zero-indexed argument, or undefined if there's no such argument. bool hasdefined(unsigned i) const returns true if the i-th zero-indexed argument is present and is not undefined. methods inherited from js::detail::callreceiverbase method description jsobject &callee() cons...
JS::Value
js type jsval type tests jsval constants and constructors jsval accessors null jsval_is_null(v) jsval_null undefined jsval_is_void(v) jsval_void boolean jsval_is_boolean(v) jsval_true, jsval_false, boolean_to_jsval(b) jsval_to_boolean(v) number jsval_is_number(v), jsval_is_int(v), jsval_is_double(v) jsval_zero, jsval_one, int_to_jsval(i), double_to_jsval(d) jsval_to_int(v), jsval_to_double(v) string jsval_is_string(v) string_to_jsval(str) jsval_to_string(v), js_getstringchars(str), js_getstringlength(str) object !jsval_is_primitive(v) object_to_jsval(obj) jsval_to_object(v) there was also a further method, jsval_is_object(v), which did not what you would ...
JSClass.flags
if this flag is set, each instance of the class has a field for private data. the field can be accessed using js_getprivate and js_setprivate. mxr id search for jsclass_has_private jsclass_private_is_nsisupports mozilla extension. ...
JSNewEnumerateOp
ould be allocated and stored in *statep. (you can use private_to_jsval to tag the pointer to be stored). the number of properties that will be enumerated should be returned as an integer jsval in *idp, if idp is non-null, and provided the number of enumerable properties is known. if idp is non-null and the number of enumerable properties can't be computed in advance, *idp should be set to jsval_zero. jsenumerate_init_all used identically to jsenumerate_init, but exposes all properties of the object regardless of enumerability. jsenumerate_next a previously allocated opaque iterator state is passed in via statep. return the next jsid in the iteration using *idp. the opaque iterator state pointed at by statep is destroyed and *statep is set to jsval_null if there are no properties left...
JSNewResolveOp
hook must therefore null *objp to signify "not resolved". with only jsclass_new_resolve and no jsclass_new_resolve_gets_start, the hook can assume *objp is null on entry. this is not good practice, but enough existing hook implementations count on it that we can't break compatibility by passing the starting object in *objp without a new jsclass flag. flags the flags argument is the logical or of zero or more of the following flags. the flags describe what kind of property access triggered the resolve callback. (the same flags are used in js_lookuppropertywithflags.) jsresolve_qualified obsolete since jsapi 20 the property access uses the . or [] operator: obj.id or obj[id], not id. jsresolve_assigning obsolete since jsapi 31 the property appears on the left-hand side of an as...
JSObjectOps.destroyObjectMap
ould be removed at any time. try to avoid using it. warning! jsobjectops is not a supported api. details of the api may change from one release to the next. this documentation should be considered spidermonkey internals documentation, not api documentation. see bug 408416 for details. the jsobjectops.destroyobjectmap callback is called to destroy a jsobjectmap when its reference count goes to zero. syntax typedef void (*jsobjectmapop)(jscontext *cx, jsobjectmap *map); name type description cx jscontext * pointer to the js context in which garbage collection is happening. map jsobjectmap * the map to destroy. ...
JSObjectOps.getRequiredSlot
nd set a required slot, one that should already have been allocated. these operations are infallible, so required slots must be pre-allocated, or implementations must suppress out-of-memory errors. the native ops (js_objectops, see js/src/jsobj.cpp) access slots reserved by including a call to the jsclass_has_reserved_slots(n) macro in the jsclass.flags initializer. note: the slot parameter is a zero-based index into obj slots, unlike the index parameter to the js_getreservedslot and js_setreservedslot api entry points, which is a zero-based index into the jsclass_reserved_slots(clasp) reserved slots that come after the initial well-known slots: proto, parent, class, and optionally, the private data slot. ...
JSPropertySpec
/* added in jsapi 28 */ const char *selfhostedgetter; const char *selfhostedsetter; }; name type description name const char * name to assign the property. tinyid int8 obsolete since jsapi 31 unique id number for the property to aid in resolving getproperty and setproperty method calls. this value should be zero if you are not using tinyids (i.e. the getter/setter function is only used by one property). flags uint8_t the bitwise or of any number of property attributes. getter jsnativewrapper or selfhostedwrapper getter method for the property. setter jsnativewrapper or selfhostedwrapper setter method for the property. if a property is read-only, its setter is ...
JSVAL_NULL
rk in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. the jsval that represents the javascript value null. syntax jsval_null description jsval_null is a jsval constant that represents the javascript value null. it is equivalent to object_to_jsval(null). see also mxr id search for jsval_null jsval_void jsval_true jsval_false jsval_zero jsval_one bug 1177825 -- removed ...
JSVAL_ONE
s obsolete. ...
JSVAL_VOID
bsolete. ...
JS_AddArgumentFormatter
d return false after reporting an error or detecting an already-reported error. for a given format string, for example "aa", the formatter is called from js_convertargumentsva like so: formatter(cx, "aa...", js_true, &sp, &ap); sp points into the arguments array on the js stack, while ap points into the stdarg.h va_list on the c stack. the js_true passed for fromjs tells the formatter to convert zero or more jsvals at sp to zero or more c values accessed via pointers-to-values at ap, updating both sp (via *vpp) and ap (via *app) to point past the converted arguments and their result pointers on the c stack. when called from js_pushargumentsva, the formatter is invoked thus: formatter(cx, "aa...", js_false, &sp, &ap); where js_false for fromjs means to wrap the c values at ap according to the...
JS_ClearContextThread
learcontextthread(cx); /* note: outside the request */ } js_setcontextthread ties cx to the current thread for exclusive use. no other thread may use cx until the current thread removes this association by calling js_clearcontextthread. js_setcontextthread returns the thread id of the thread previously associated with this context. when the function is used properly, the return value is always zero, indicating that no thread was previously associated with the context. js_clearcontextthread relinquishes the calling thread's right to use cx. it returns the thread id of the last thread to be associated with this context. (this is always the current thread id when the function is used properly.) js_newcontext automatically associates the new context with the calling thread. use js_getcontext...
JS_ConcatStrings
cx jscontext * the context in which both the strings have been created. left js::handlestring first string to concatenate. right js::handlestring second string to concatenate. description js_concatstrings concatenates two js strings, str1 and str2, and returns the result. the result could be the same as one of the input strings, if the other string is zero length. when the string concatenation fails null is returned. see also mxr id search for js_concatstrings ...
JS_GetFunctionFlags
nction *fun); name type description fun jsfunction * the function to examine. description js_getfunctionflags retrieves the function flags of a given javascript function, fun. these flags are for the javascript engine’s internal use. most applications can’t do anything useful with them. function flags are a value of type unsigned int, the bitwise or of zero or more of the jsfun flags described below. once a function is created, its flags cannot be modified. jsfun_generic_native the function is an array generic, such as array.map. jsfun_heavyweight the function uses language features such as closures, with, or eval that require extra work on the part of the interpreter. jsfun_lambda the function is a javascript function written as a...
JS_GetGCParameter
hresholdfactoravoidinterrupt" jsgc_min_empty_chunk_count / "minemptychunkcount" we try to keep at least this many unused chunks in the free chunk pool at all times, even after a shrinking gc. jsgc_max_empty_chunk_count / "maxemptychunkcount" we never keep more than this many unused chunks in the free chunk pool. jsgc_compaction_enabled / "compactingenabled" non-zero to enable compacting, zero to disable. jsgc_nursery_free_threshold_for_idle_collection / "nurseryfreethresholdforidlecollection" collect the nursery in idle time if it has less than this many bytes of free space. jsgc_nursery_free_threshold_for_idle_collection_percent / "nurseryfreethresholdforidlecollectionpercent" collect the nursery in idle time if it has less than this...
JS_GetOptions
d be removed at any time. try to avoid using it. get the currently enabled jscontext options. syntax uint32 js_getoptions(jscontext *cx); name type description cx jscontext * the context from which to read options. description js_getoptions retrieves the option flags of a given js context cx. this function returns a uint32 value that is the logical or of zero or more of the jsoption flags described in js_setoptions. see also mxr id search for js_getoptions js_setoptions js_toggleoptions bug 880330 ...
JS_GetPositiveInfinityValue
tiveinfinityvalue returns a js::value that represents an ieee floating-point positive infinity. js_getnegativeinfinityvalue returns the corresponding negative infinity. infinities are typically used to represent numbers that are greater in magnitude than the greatest representable finite values. as a value in mathematical calculations, an infinite value behaves like infinity. for example, any nonzero value multiplied by infinity is infinity with the expected sign, and any finite value divided by infinity is zero (again with the expected sign). to get a floating-point nan, use js_getnanvalue. see also mxr id search for js_getpositiveinfinityvalue mxr id search for js_getnegativeinfinityvalue js_getnanvalue bug 1184564 -- changed jsval to js::value ...
JS_GetPropertyAttributes
are unspecified. if obj does not have the specified property, or if it inherits it from some other object (on its prototype chain, for example), then *foundp is set to js_false. the value left in *attrsp is unspecified. the return value is js_true (to indicate that no error occurred). if the property exists and belongs to obj, then *foundp is set to js_true, *attrsp is set to the logical or of zero or more property attributes flags, and the function returns js_true. see also property attributes bug 893186 ...
JS_GetStringChars
a pointer to the first element of an array of jschars. warnings: the array is not necessarily null-terminated. to get the length of the string, use js_getstringlength. the program must not modify the array. if it does, the behavior is undefined. the content of a js string is not guaranteed to be valid utf-16. it may contain surrogate code units that aren't properly paired. it may also contain zeroes. the array returned by this function remains valid as long as str is valid. (eventually, str becomes unreachable, the garbage collector collects it, and the array is freed by the system.) js_getstringcharsz is the same except that it always returns either a null-terminated string or null, indicating out-of-memory. see also bug 609440 - removed js_getstringchars bug 1037869 - removed js_gets...
JS_NewArrayObject
it reports an error as though by calling js_reportoutofmemory and returns null. obsolete since jsapi 30. js_newarrayobject with length parameter creates a new array object with the specified length. if vector is non-null, then for each index i from 0 to length - 1, js_newarrayobject defines an enumerable array element with the value vector[i] on the new array. (this means that if length is nonzero and vector is null, the result is like the javascript expression new array(length). the new array has the specified length, but it doesn't have any elements.) it is often better to call js_newarrayobject(cx, 0, null), store the returned object in a gc root, and then populate its elements with js_setelement or js_defineelement. this avoids unrooted jsvals in vector from being subject to garbage c...
JS_NewExternalString
opulated with the desired character data before js_newexternalstring is called, and the array must remain in memory, with its contents unchanged, for as long as the javascript engine needs to hold on to it. (ultimately, the string will be garbage collected, and the javascript engine will call the string finalizer callback, allowing the application to free the array.) the array does not need to be zero-terminated. length size_t the number of characters in the array chars. fin jsstringfinalizer a string finalizer the javascript engine should use (later) to free the string buffer chars. added in spidermonkey 17 type int (js_newexternalstringwithclosure only) indicates which string finalizer callback the javascript engine should use (later) to free the ...
JS_ScheduleGC
js_schedulegc(jscontext *cx, uint32_t count); name type description cx jscontext * a context. the gc zeal level of the associated jsruntime is set. frequency uint32_t the value of nextscheduled parameter of gc. description js_schedulegc sets the nextscheduled parameter of gc. at every allocation nextscheduled is decremented. when it reaches zero, we do either a full or a compartmental gc. at this point, if zeal is one of the types that trigger periodic collection, then nextscheduled is reset to the value of frequency. otherwise, no additional gcs take place. see also mxr id search for js_schedulegc js_setgczeal bug 650978 ...
JS_SetPropertyAttributes
lues to set. foundp jsbool * out parameter. flag indicating whether or not the specified property was located. description js_setpropertyattributes sets the attributes for a specified property, name of an object obj. js_setucpropertyattributes is the unicode version of the function. attrs is an unsigned integer containing the attribute value to set. it is the bitwise or of zero or more of the following values: flag purpose jsprop_enumerate property is visible in for and in loops. jsprop_readonly property is read only. jsprop_permanent property cannot be deleted. jsprop_exported property can be imported by other objects. jsprop_index property is actually an index into an array of properties, and is ...
JS_SuspendRequest
x. this allows the runtime to perform garbage collection if needed and allows other threads to access objects that the calling thread had locked. the return value is the number of nested requests that were suspended. it may be 0. js_resumerequest resumes the previously suspended requests. the savedepth argument must be the value returned by the matching js_suspendrequest call. if savedepth is nonzero and garbage collection is underway, js_resumerequest blocks until the garbage collector is done. jsapi 1.7 and earlier js_suspendrequest and js_resumerequest are available only in js_threadsafe builds. in spidermonkey 1.8 and later, these functions will be present, but will do nothing, in non-js_threadsafe builds. mxr id search for js_suspendrequest mxr id search for js_resumerequest ...
JS_ToggleOptions
me browsers, its use is discouraged since it could be removed at any time. try to avoid using it. toggle specified options on a jscontext. syntax uint32 js_toggleoptions(jscontext *cx, uint32 options); name type description cx jscontext * a context on which to modify options. options uint32 the set of options to toggle. this is the logical or of zero or more flags described at js_setoptions. description js_toggleoptions toggles context-wide options. it is equivalent to js_setoptions(cx, js_getoptions(cx) ^ options). see also mxr id search for js_toggleoptions js_setoptions js_getoptions bug 880330 ...
JS_ValueToECMAInt32
specification. js_valuetoecmaint32 implements the toint32 operator specified in ecma 262-3 9.5. js_valuetoecmauint32 implements the touint32 operator specified in ecma 262-3 9.6. js_valuetouint16 implements the touint16 operator specified in ecma 262-3 9.7. all three functions first convert v to a floating-point number as if by calling js_valuetonumber; nan values are then converted to zero. if that succeeds, the result is then converted to the target integer type. this second conversion cannot fail. on success, js_valuetoecmaint32 stores the converted value in *ip and returns js_true. on error or exception, it returns js_false, and the value left in *ip is undefined. see also js::touint16 js::toint32 js::touint32 js::toint64 js::touint64 js::tonumber bug 933810 bug 9339...
JS_updateMallocCounter
name type description cx jscontext * pointer to a js context to decrement the malloc counter. nbytes size_t number of bytes to decrement from malloc counter. description js_updatemalloccounter decrements malloc counter of gc and the zone of the context. malloc counter measures memory pressure for gc scheduling. it runs from maxmallocbytes down to zero. maxmallocbytes is initialized with maxbytes parameter of js_newruntime, and could be configured later by calling js_getgcparameter with jsgc_max_malloc_bytes. see also mxr id search for js_updatemalloccounter changeset 88cfae411a2a js_newruntime js_getgcparameter bug 517665 ...
Property attributes
an application can set property attributes when creating a property. see js_defineproperty, js_fs, and js_fn flag description jsprop_enumerate the property is visible to javascript for...in and for each ... in loops, as well as to js_enumerate. this is the inverse of the ecma standard dontenum attribute. ...
jschar
ypedef for the standard c++ type char16_t, will be removed in jsapi 38. functions that use jschar will use char16_t directly. embedder code should use char16_t, too. (see bug 1063962.) as required by the ecmascript standard, ecma 262-3 §4.3.16", javascript strings are arbitrary sequences of 16-bit values. a string may contain unmatched surrogates, which are not valid utf-16. it may also contain zeroes ('\0'). to get the characters of a javascript string, use js_getstringchars. see also bug 1063962 ...
Running Automated JavaScript Tests
push to the mozilla repositories, jit-tests are run by calling make check, and appear under b. creating new tests for jit-tests creating new tests for jit-tests is easy. just add a new js file to the tests/basic directory (or any appropriate directory under 'tests'). the test harness will automatically find the test and run it. the test is considered to pass if the exit code of the js shell is zero (i.e., js didn't crash and there were no js errors). use the asserteq function to verify values in your test. there are some advanced options for tests. see the readme (in js/src/jit-tests) for details. ...
Shell global objects
s to stdout. printerr([exp ...]) evaluate and print expressions to stderr. putstr([exp]) evaluate and print expression without newline. datenow() return the current time with sub-ms precision. help([name ...]) display usage and help messages. quit() quit the shell. asserteq(actual, expected[, msg]) throw if the first two arguments are not the same (both +0 or both -0, both nan, or non-zero and ===). starttimingmutator() start accounting time to mutator vs gc. stoptimingmutator() stop accounting time to mutator vs gc and dump the results. throwerror() throw an error from js_reporterror. intern(str) internalize str in the atom table. getslx(obj) get script line extent. evalcx(s[, o]) evaluate s in optional sandbox object o. if (s == '' && !o) return new o with eager stand...
Redis Tips
sets, you can periodically cull expired objects by using the zremrangebyscore and zremrangebyrank commands. mutex locks in the case where you need a mutex, here's a recipe for using the atomic getset and setnx to orchestrate locking: https://redis.io/commands/setnx (scroll down). i have used this recipe in production. bit strings bit strings are just that: compact representations of ones and zeroes. i haven't yet used bitstrings in production myself. i recommend reading this article on realtime metrics with bitstrings: https://blog.getspool.com/2011/11/29/fast-easy-realtime-metrics-using-redis-bitmaps/. extra data in zsets the score for a zset value is a float. you can be clever and sneak extra data in by encoding something else after the decimal. this adds processing time and compl...
The Rust programming language
rust is a new open-source systems programming language created by mozilla and a community of volunteers, designed to help developers create fast, secure applications which take full advantage of the powerful features of modern multi-core processors. it prevents segmentation faults and guarantees thread safety, all with an easy-to-learn syntax. in addition, rust offers zero-cost abstractions, move semantics, guaranteed memory safety, threads with no data races, trait-based generics, pattern matching, type inference, and efficient c bindings, with a minimum runtime size. to learn more about rust, you can: watch the videos below for a closer look at the power and benefits rust provides. read the book the rust programming language online. download the rust compiler, check out exampl...
Exploitable crashes
mory that isn't part of the program. these crashes are almost always exploitable to run arbitrary code. look at the crash reason, which will usually be something like "kern_protection_failure (0x0002) at 0x00000000". this is typically located right above the stack trace. the last number, in this case 0x00000000, is the memory address firefox was prevented from accessing. if the address is always zero (or close to zero, such as 0x0000001c), it's probably a null dereference bug. these bugs cause the browser to crash, but they do so in a predictable way, so they are not exploitable. most crashes fall into this category. check the length of the stack trace. if it's over 300 functions long, it's likely to be a too-much-recursion crash. like null dereferences, these crashes are not exploitable. a...
Frecency algorithm
ags. this score is determined by the amount of revisitation, the type of those visits, how recent they were, and whether the uri was bookmarked or tagged. the word "frecency" itself is a combination of the words "frequency" and "recency." the default frecency value for all valid entries is -1. places with this value can show up in autocomplete results. invalid places have a frecency value of zero, and will not show up in autocomplete results. examples of invalid places are "place:" queries, and unvisited livemark feed entries. the frecency calculation process for the 10 most recent visits (where 10 is determined by places.frecency.numvisits): .. determine percentage bonus for type of visit (ie: the "transition type"): .... 0 (places.frecency.embedvisitbonus) ...
Using the Places annotation service
and not make up your own uris, because these functions will efficiently default to the default page favicon when it does not exist. see using the places favicon service for more information. lifetime of annotations annotation expiration can be explicitly stated when the annotation is created. if no expiration is specified, the annotation is expired when the number of visits to the url is set to zero. valid values for expiration are: expire_with_history : default. annotations live as long as the uri is in history (eg: has >0 visits). expire_never : never expire. must be explictly removed. expire_session : removed at application exit. expire_days : removed at 7 days. expire_weeks : removed at 30 days. expire_months : removed at 180 days. annotationservice.setpageannotation(uri, "my_...
XPCOM array guide
Mozilla › Tech › XPCOM › Guide › Arrays
the standard array classes are: nsiarray - a scriptable container for scriptable xpcom objects. ...
Avoiding leaks in JavaScript XPCOM components
ficult to use this strategy when there are multiple pointers to a given object and it's uncertain which one will need to last the longest. reference counting reference counting is a simple solution to the problem of allowing multiple owners to influence the lifetime of an object. in this strategy, the object has a member that is the number of other objects that "own" it. when this count goes to zero, the object destroys itself. this is the strategy used by xpcom, partly because it can be used through a very simple api, addref and release. in c++, we use nscomptr to help manage ownership, and we use macros to implement addref and release. the major problem with reference counting is that it can cause leaks through ownership cycles. if object a owns object b, and object b owns object a, then ...
An Overview of XPCOM
gets created, an integer inside the component tracks the number of clients who have an interface to the components -- also known as the reference count. the reference count is incremented automatically when the client instantiates the component; over the course of the component's life, the reference count goes up and down. when all clients lose interest in the component, the reference count hits zero, and the component deletes itself. when clients use interfaces responsibly, this can be a very straightforward process. xpcom has tools to make it even easier, as we describe later. it can raise some real housekeeping problems when, for example, a client uses an interface and forgets to decrement the reference count. when this happens, interfaces may never be released and will leak memory. the s...
Starting WebLock
can be passed as an nsisupports object. the nsisimpleenumerator interface is shown in the web locking interface. the first method returns a boolean if there are more elements in the set. internally, the object knows the number of elements it has in its enumeration, and every time a client calls getnext, it decrements a counter - or adjusts a pointer to the next element. when the counter goes to zero or the pointer points to a non-element, hasmoreelements will return false. there is no way to reset an nsisimpleenumerator. for example, you can't re-enumerate the set. if you need random access to the elements in a nsisimpleenumerator, you can read them from the nsisimpleenumerator, store them in an array, and access them there. the getnext method returns a nsisupports interface pointer. when ...
XPCOM guide
Mozilla › Tech › XPCOM › Guide
ion's startup process, so they can start new services at appropriate times, for example.xpcom array guidemozilla has many array classes because each array is optimized for a particular usage pattern. this guide describes the available arrays as well as the enumerator classes that can be used to get to them. in this document the term array refers to a container for multiple objects with a numeric, zero-based index.xpcom changes in gecko 2.0several changes that affect xpcom component compatibility are taking place in gecko 2. this article details those changes, and provides suggestions for how to update your code.xpcom hashtable guidea hashtable is a data construct that stores a set of items. each item has a key that identifies the item. items are found, added, and removed from the hashtable by ...
Interfacing with the XPCOM cycle collector
ollector does the cycle collector spends most of its time accumulating (and forgetting about) pointers to xpcom objects that might be involved in garbage cycles. this is the idle stage of the collector's operation, in which special variants of nsautorefcnt register and unregister themselves very rapidly with the collector, as they pass through a "suspicious" refcount event (from n+1 to n, for nonzero n). periodically the collector wakes up and examines any suspicious pointers that have been sitting in its buffer for a while. this is the scanning stage of the collector's operation. in this stage the collector repeatedly asks each candidate for a singleton cycle-collection helper class, and if that helper exists, the collector asks the helper to describe the candidate's (owned) children. this ...
Introduction to XPCOM for the DOM
increase the reference count of that object by one. the function that does this is called "addref" and is defined in the nsisupports interface. when the pointer no longers holds the address of that object, it has to decrease the reference count of that object by one. this is done using the "release" function, also defined in the nsisupports interface. when the reference count of an object hits 0 (zero), the object deletes itself. this is why it is very important to keep track of the reference count of each object. in the first case, if we forget to addref the object, the object may delete itself before we are done using the pointer, which would cause a crash when dereferencing it. in the second case, if we forget to release the object, it will never delete itself, which will cause "memory leak...
Components.isSuccessCode
ucceeded = components.issuccesscode(returncode); parameters returncode the return code (of type nsresult) to be checked. description components.issuccesscode() may be used to determine whether an xpcom return code (an nsresult) indicates success or failure. an xpcom return code indicates success if its high-order bit is 0, and it indicates failure if its high-order bit is 1. note: a non-zero xpcom return code (that is, not ns_ok) does not necessarily indicate failure. components.issuccesscode() is functionally equivalent to the following javascript: function issuccesscode(returncode) { return (returncode & 0x80000000) === 0; } since failure error codes are turned into exceptions when encountered in javascript, this function usually is not necessary. however, if you are using as...
NS_Realloc
using the xpcom memory manager. #include "nsxpcom.h" void* ns_realloc( void* aptr, prsize asize ); parameters aptr [in] a pointer to the block of memory to reallocate. this pointer must have been previously allocated by the xpcom memory manager, or this parameter may be null in which case this function behaves like ns_alloc. asize [in] the size in bytes of the block to allocate, or zero if the given block is to be freed. return values this function returns a pointer to the allocated block of memory, which is suitably aligned for any kind of variable, or null if the allocation failed. remarks this function provides a convenient way to access the xpcom memory manager. it is equivalent to calling realloc on the nsimemory instance returned from ns_getmemorymanager. history ...
Append
e length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void append( char_type achar ); parameters achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Assign
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void assign( char_type achar ); parameters achar [in] the character to copy into this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Insert
a need not be null terminated. void insert( char_type achar, index_type aposition ); parameters achar [in] a character to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Replace
...
Append
e length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void append( char_type achar ); parameters achar [in] a character to append to this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Assign
length of adata, measured in storage units. if equal to pr_uint32_max, then adata is assumed to be null-terminated. otherwise, adata need not be null terminated. void assign( char_type achar ); parameters achar [in] the character to copy into this string. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Insert
a need not be null terminated. void insert( char_type achar, index_type aposition ); parameters achar [in] a character to append to this string. aposition [in] an offset into the string's internal buffer specifying where to place the given characters. remarks if insufficient memory is available to perform the assignment, then the string's internal buffer will point to a static empty (zero-length) buffer. ...
Replace
...
nsEmbedCString
...
nsEmbedString
...
IAccessibleAction
invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is null. s_ok. nactions() returns the number of accessible actions available in this object. if there are more than one, the first one is considered the "default" action of the object. hresult nactions( [out] long nactions ); parameters nactions the returned value of the number of actions is zero if there are no actions. return value s_ok. name() returns the non-localized name of the specified action. [propget] hresult name( [in] long actionindex, [out] bstr name ); parameters actionindex 0 based index specifying which action's non-localized name should be returned. name the non-localized name of the specified action. return value e_invalidarg if bad [in] passed, [out] value is nu...
IAccessibleEditableText
limited to editable objects. the substrings used with this interface are specified as follows: if startoffset is less than endoffset, the substring starts with the character at startoffset and ends with the character just before endoffset. if endoffset is lower than startoffset, the result is the same as a call with the two arguments exchanged. the whole text can be defined by passing the indices zero and iaccessibletext.ncharacters(). if both indices have the same value, an empty string is defined. refer to the @ref _specialoffsets "special offsets for use in the iaccessibletext and iaccessibleeditabletext methods" for information about a special offset constant that can be used in iaccessibleeditabletext methods. method overview hresult copytext([in] long startoffset, [in] long endoffset ...
IAccessibleHypertext
aracter index. this is the case when a link spans the given character index. [propget] hresult hyperlinkindex( [in] long charindex, [out] long hyperlinkindex ); parameters charindex a 0 based index of the character for which to return the link index. if iaccessibletext is used to represent the text containing the link, then the character index is only valid if it is greater than or equal to zero and lower than the number of characters in the text. hyperlinkindex the 0 based index of the hyperlink that is associated with this character index, or -1 if charindex is not on a link. return value e_invalidarg if bad [in] passed, [out] value is null. s_false if there is nothing to return, [out] value is -1. s_ok. nhyperlinks() returns the number of links and link groups contained within this h...
mozIAsyncFavicons
he given page. void getfaviconurlforpage( in nsiuri apageuri, in nsifavicondatacallback acallback ); parameters apageuri uri of the page whose favicon's url we're looking up. acallback once we have found the favicon's url, we invoke this callback. note that the callback's adatalen will be 0, adata will be null, and amimetype will be empty -- only auri will be non-zero/null/empty. getfavicondataforpage() retrieves the favicon uri and data associated to the given page, if any. void getfaviconurlforpage( in nsiuri apageuri, in nsifavicondatacallback acallback ); parameters apageuri uri of the page whose favicon uri and data we're looking up. acallback this callback is always invoked to notify the result of the lookup. the auri p...
mozIStorageRow
d a summary to this article. last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: mozistoragevaluearray method overview nsivariant getresultbyindex(in unsigned long aindex); nsivariant getresultbyname(in autf8string aname); methods getresultbyindex() returns the value from a specific column in the row, using a zero-based index to identify the column. nsivariant getresultbyindex( in unsigned long aindex ); parameters aindex the zero-based index of the column number whose value is to be returned. return value an nsivariant object containing the value of the specified column. getresultbyname() returns the value from a specific column in the row, identifying the column by name. nsivariant getresultbyna...
mozITXTToHTMLConv
>") at the beginning of the line to indicate cite levels. unsigned long citeleveltxt( in wstring line, out unsigned long loglinestart ); parameters line the original line of text, which may begin with one or more cite characters such as ">". loglinestart on output, this parameter is set to indicate the offset into the string of the first non-cite character. you must set this value to zero before calling this method. return value the cite level of the quote; that is, the number of text quote characters found at the beginning of the string. findurlinplaintext() returns the start and end offsets of the first url found in a substring. void findurlinplaintext( in wstring text, in long alength, in long apos, out long astartpos, out long aendpos ); parameters text t...
nsIAccessNode
uniqueid voidptr a unique id calculated for this dom node, for the purposes of caching and referencing this object. read only. native code only! methods getchildnodeat() obsolete since gecko 2.0 (firefox 4 / thunderbird 3.3 / seamonkey 2.1) get the nth child of this node. nsiaccessnode getchildnodeat( in long childnum ); parameters childnum zero-based child index. return value the nth nsiaccessnode child. exceptions thrown ns_error_failure indicates that the access node is unattached from the accessible tree. getcomputedstylecssvalue() retrieve the computed style value as nsidomcssprimitivevalue for the dom node this access node is associated with. note: the meanings of width, height and other size measurements depend on the ...
GetActionDescription
return value returns the description of the accessible action. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree. ns_error_invalid_arg indicates that the given index is our of range. ...
GetActionName
return value returns the name of the accessible action. exceptions thrown ns_error_failure indicates that the accessible is unattached from the accessible tree.ns_error_invalid_arg indicates that the given index is our of range. ...
GetKeyBindings
zed string of global keyboard accelerator for the given action index supported by accessible. nsidomdomstringlist getkeybindings( in pruint8 aactionindex ); parameters aactionindex[in] index of the given action. return values returns array of localized string of global keyboard accelerator. exceptions thrown ns_error_invalid_arg the given index doesn't correspond to default action (not zero). remark key bindings are supported for default action only. see also nsiaccessible.defaultkeybinding nsiaccessible.keyboardshortcut ...
GetRelation
elation for this accessible object by index. nsiaccessiblerelation getrelation( in unsigned long aindex ); parameters aindex[in] the index for which relation is to be retrieved. return value returns nsiaccessiblerelation object for this accessible. exception thrown ns_error_invalid_arg indicates that the given index is invalid. remark currently we do not support multiple relations so the zero index may be valid only. refer to relations documentation for more info. see also nsiaccessible.relationscount nsiaccessible.getrelations() nsiaccessible.getaccessiblerelation() ...
nsIAccessibleRelation
0x0f this object is describes the target object. relation_default_button 0x4000 part of a form/dialog with a related default button. it is used for msaa only, no for ia2 nor atk/at-spi. methods gettarget() returns accessible relation target at the given index. nsiaccessible gettarget( in unsigned long index ); parameters index zero-based index of relation target. return value returns an nsiaccessible object. exceptions thrown ns_error_invalid_arg indicates the given index is out of range. gettargets() returns an array of accessible relation targets. nsiarray gettargets(); parameters none. return value an nsiarray object, each item in the array implements an nsiaccessible. ...
nsIArray
for an array which can be modified, see nsimutablearray. ...
nsIAsyncInputStream
osed. void asyncwait( in nsiinputstreamcallback acallback, in unsigned long aflags, in unsigned long arequestedcount, in nsieventtarget aeventtarget ); parameters acallback this object is notified when the stream becomes ready. this parameter may be null to clear an existing callback. aflags this parameter specifies optional flags passed in to configure the behavior of this method. pass zero to specify no flags. arequestedcount wait until at least this many bytes can be read. this is only a suggestion to the underlying stream; it may be ignored. the caller may pass zero to indicate no preference. aeventtarget specify null to receive notification on any thread (possibly even recursively on the calling thread, that is synchronously), or specify that the notification be delivered to a s...
nsIAsyncOutputStream
sed. void asyncwait( in nsioutputstreamcallback acallback, in unsigned long aflags, in unsigned long arequestedcount, in nsieventtarget aeventtarget ); parameters acallback this object is notified when the stream becomes ready. this parameter may be null to clear an existing callback. aflags this parameter specifies optional flags passed in to configure the behavior of this method. pass zero to specify no flags. arequestedcount wait until at least this many bytes can be written. this is only a suggestion to the underlying stream; it may be ignored. the caller may pass zero to indicate no preference. aeventtarget specify null to receive notification on any thread (possibly even recursively on the calling thread, that is synchronously), or specify that the notification be delivered to ...
nsIDOMGeoPositionCoords
last changed in gecko 1.9.1 (firefox 3.5 / thunderbird 3.0 / seamonkey 2.0) inherits from: nsisupports attributes attribute type description latitude double the user's current latitude, in degrees. read only. longitude double the user's current longitude, in degrees. read only. altitude double the user's current altitude, in meters. zero if the device doesn't support altitude detection. read only. accuracy double the accuracy of position information, in meters. read only. altitudeaccuracy double the accuracy of altitude information, in meters. zero if the device doesn't support altitude detection. read only. heading double the current heading at which the user is moving, in degrees. re...
nsIDebug2
read only. isdebugbuild boolean whether xpcom was compiled with debug defined. this often correlates to whether other code (for example, firefox, xulrunner) was compiled with debug defined. read only. see also nsidebug ...
nsIDownloadManager
download adddownload( in short adownloadtype, in nsiuri asource, in nsiuri atarget, in astring adisplayname, in nsimimeinfo amimeinfo, in prtime astarttime, in nsilocalfile atempfile, in nsicancelable acancelable, in boolean aisprivate ); parameters adownloadtype the download type for the transfer. should always be set to nsidownloadmanager.download_type_download (that is, zero). asource the source uri of the transfer. must not be null. atarget the uri indicating where the transferred file should be stored. must not be null. adisplayname a user-readable description of the transfer. may be an empty string. amimeinfo the mime information associated with the target; this may include mime type and helper application when appropriate. this parameter is optional. ...
nsIDragService
the current drag session. startdragsession() tells the drag service to start a drag session. this is called when an external drag occurs void startdragsession(); parameters none. suppress() increase dragging suppress level by one. this disables dragging if it is not already disabled. void suppress(); parameters none. unsuppress() decrease dragging suppress level by one. if level is zero, dragging is re-enabled. void unsuppress(); parameters none. ...
nsIDragSession
e that the drag is currently in. native code only! methods getdata() gets data from a drag and drop operation. can be called while the drag is in process or after the drop has completed. void getdata( in nsitransferable atransferable, in unsigned long aitemindex ); parameters atransferable the transferable for the data to be put into. aitemindex which of multiple drag items, zero-based. must be less than numdropitems. isdataflavorsupported() checks to see if any of the native data on the clipboard matches a given data flavor. if numdropitems is greater than one, there is no indication as to which of the items matches the data flavor. boolean isdataflavorsupported( in string adataflavor ); parameters adataflavor a string representing the mime type of the data t...
nsIHttpChannel
large. this attribute is true by default, though other factors may prevent pipelining. this attribute may only be set before the channel is opened. exceptions thrown ns_error_failure if set after the channel has been opened. redirectionlimit unsigned long this attribute specifies the number of redirects this channel is allowed to make. if zero, the channel will fail to redirect and will generate a ns_error_redirect_loop failure status. note: an http redirect results in a new channel being created. if the new channel supports nsihttpchannel, then it will be assigned a value to its redirectionlimit attribute one less than the value of the redirected channel's redirectionlimit attribute. the initial value for this attribute may ...
nsIINIParserWriter
nsiiniparserwriter xpcom/ds/nsiiniparser.idlscriptable allows writing to an ini-format configuration file. 1.0 66 introduced gecko 1.9.2 inherits from: nsisupports last changed in gecko 13.0 (firefox 13.0 / thunderbird 13.0 / seamonkey 2.10) this interface provides methods that allow writing to ini-format configuration files. ini files contain zero or more sections, denoted by a name in square brackets, followed by zero or more lines of text with a property name on the left, then an equals sign ("="), then the value of the property. to create an nsiiniparserwriter object, you use the nsiiniparserfactory interface to create a parser, then nsisupports.queryinterface() that to get an nsiiniparserwriter, like this: let writer = components.classes["@mozil...
nsIMsgHeaderParser
ve code only!parseheaderaddresses given a string which contains a list of header addresses, parses it into their component names and mailboxes. the returned value is the number of addresses, or a negative error code; the names and addresses are returned into the provided pointers as consecutive null-terminated strings. it is up to the caller to free them. note that some of the strings may be zero-length. the caller may pass nsnull for charset and it will be interpreted as "us-ascii". either of the provided pointers may be null if the caller is not interested in those components. void parseheaderaddresses( in string line, out string names, out string addresses, out pruint32 numaddresses ); parameters line the header line to parse. names a string of the names in the h...
nsINavHistoryResultNode
rvice. if the entry doesn't have a favicon, this is the chrome uri of the default favicon. if the favicon originally lived in chrome, this will be the original chrome uri of the icon. read only. note: prior to gecko 1.9.2, this was an nsiuri. indentlevel long this is the number of levels between this node and the top of the hierarchy. the members of result.children have an indentlevel value of zero, their children have an indentlevel of 1, and so forth. the indent level of the root node is set to -1. read only. itemid long long if the node is an item (bookmark, folder, or separator), this value is the row id of that bookmark in the database. for other nodes, this value is set to -1. read only. lastmodified prtime if the node is an item (bookmark, folder, or separator), this value is th...
nsINavHistoryResultObserver
de the moved node. aoldparent the node's old parent. aoldindex the node's index in the old parent. anewparent the node's new parent. anewindex the node's index in the new parent. noderemoved() called when a item is removed from a container. the item may be a container or a leaf. this method is called after the item has been removed from the parent, but before any other action is taken (including zeroing out the item's parent reference). void noderemoved( in nsinavhistorycontainerresultnode aparent, in nsinavhistoryresultnode aitem, in unsigned long aoldindex ); parameters aparent the container from which the item was removed. aitem the item that was removed from the container. it may be either a container or a leaf. aoldindex the index from which the item was removed. nodereplaced...
nsINavHistoryResultViewer
resultnode anode, in unsigned long aoldindex ); parameters parent the container from which the item was removed. item the item that was removed from the container. it may be either a container or a leaf. oldindex the index from which the item was removed. remarks this method is called after the item has been removed from the parent, but before any other action is taken (including zeroing out the item's parent reference). nodetagschanged() called right after a node's tags have changed. void nodetagschanged( in nsinavhistoryresultnode anode ); parameters anode the node whose tags have changed. nodereplaced() called when a node is being replaced with another node at the same location. void nodereplaced(in nsinavhistorycontainerresultnode aparentnode, in nsinavh...
nsIOutputStream
ream.readsegments(), but that is not guaranteed. native code only!writesegments low-level write method that has access to the stream's underlying buffer. the reader function may be called multiple times for segmented buffers. this method is expected to keep calling the reader until either there is nothing left to write or the reader returns an error. this method should not call the reader with zero bytes to provide. note: a nsioutputstream is not required to implement this method. in some contexts, writesegments may be guaranteed to be implemented, but in general it is not. this method serves as an optimization. unsigned long writesegments( in nsreadsegmentfun areader, in voidptr aclosure, in unsigned long acount ); parameters areader a callback function that may be called mul...
nsIPromptService
ss one of the button default flags is specified (see button default flags). a button may use a predefined title, specified by one of the button title flags values. each title value can be multiplied by a position value to assign the title to a particular button. if button_title_is_string is used for a button, the string parameter for that button will be used. if the value for a button position is zero, the button will not be shown. the following example creates a dialog with an ok button and a custom button description. abuttonflags = (button_pos_0) * (button_title_ok) + (button_pos_1) * (button_title_is_string) + button_pos_1_default; confirmex always returns 1 if the user closes the window using the close button in the titlebar! bug 345067 print32 confirmex( in nsidomwindow aparent, ...
nsIServerSocket
onstoplistening event to asynchronously fire with a status of ns_binding_aborted. void close(); parameters none. native code only!getaddress returns the address to which this server socket is bound. since a server socket may be bound to multiple network devices, this address may not necessarily be specific to a single network device. in the case of an ip socket, the ip address field would be zeroed out to indicate a server socket bound to all network devices. therefore, this method cannot be used to determine the ip address of the local system. see nsidnsservice.myhostname() if this is what you need. prnetaddr getaddress(); parameters none. return value the network address to which the socket is bound. init() initializes a server socket. void init( in long aport, in boolean a...
nsITransactionManager
peekundostack(); void redotransaction(); void removelistener(in nsitransactionlistener alistener); void undotransaction(); attributes attribute type description maxtransactioncount long sets the maximum number of transaction items the transaction manager will maintain at any time. this is commonly referred to as the number of levels of undo. a value of -1 means no limit. a value of zero means the transaction manager will execute each transaction, then immediately release all references it has to the transaction without pushing it on the undo stack. a value greater than zero indicates the max number of transactions that can exist at any time on both the undo and redo stacks. this method will prune the necessary number of transactions on the undo and redo stacks if the value speci...
nsIUpdate
also links to the release notes. displayversion astring the string to display in the user interface for the version. if you want a real version number use appversion. errorcode long a numeric error code that conveys additional information about the state of a failed update or failed certificate attribute check during an update check. if the update is not in the "failed" state, this value is zero. ok (0) no error. mem_error (1) a memory error occurred. usage_error (3) a usage error occurred; this needs to be described in more detail. crc_error (4) a checksum error occurred. parse_error (5) an error occurred while parsing the patch. read_error (6) an error occurred while reading the patch. write_error (7) an error occurred while writing the patched application. unexpected_error (8) an una...
nsIVariant
ring autf8string getasautf8string(); parameters none. return value the internal value is converted to a utf8 string. an iso-8859-1 string is widened to a utf16 string first. arrays and interface pointers cannot be converted to a string. native code only!getasbool prbool getasbool(); parameters none. return value if possible, the internal value is converted to a double, which is then compared to zero. native code only!getaschar char getaschar(); parameters none. return value if the internal value is a string, it is first converted to a double, if possible. if it is of a numeric type, it is cast directly to char. native code only!getasdomstring domstring getasdomstring(); parameters none. return value this returns the same as the getasastring method. native code only!getasdouble double getas...
nsIVersionComparator
isupports last changed in gecko 1.8 (firefox 1.5 / thunderbird 1.5 / seamonkey 1.0) version strings are dot-separated sequences of version-parts. a version-part consists of up to four parts, all of which are optional: <number-a><string-b><number-c><string-d (everything else)> a version-part may also consist of a single asterisk "*" which indicates * "infinity". numbers are base-10, and are zero if left out. strings are compared bytewise. for additional backwards compatibility, if "string-b" is "+" then "number-a" is incremented by 1 and "string-b" becomes "pre". 1.0pre1 < 1.0pre2 < 1.0 == 1.0.0 == 1.0.0.0 < 1.1pre == 1.1pre0 == 1.0+ < 1.1pre1a < 1.1pre1 < 1.1pre10a < 1.1pre10 implemented by: @mozilla.org/xpcom/version-comparator;1...
nsIWebProgressListener2
ong acurselfprogress, in long long amaxselfprogress, in long long acurtotalprogress, in long long amaxtotalprogress); boolean onrefreshattempted(in nsiwebprogress awebprogress, in nsiuri arefreshuri, in long amillis, in boolean asameuri); methods onprogresschange64() notification that the progress has changed for one of the requests associated with awebprogress. progress totals are reset to zero when all requests in awebprogress complete (corresponding to onstatechange being called with astateflags including the state_stop and state_is_window flags). this function is identical to nsiwebprogresslistener.onprogresschange(), except that this function supports 64-bit values. note: if any progress value is unknown, then its value is replaced with -1. void onprogresschange64( in nsiwebprogre...
nsIXMLHttpRequestEventTarget
lly completed. onloadend nsidomeventlistener a javascript function object that gets invoked when the operation is completed for any reason; it will always follow a an abort, error, or load event. onloadstart nsidomeventlistener a javascript function object that gets invoked exactly once when the operation begins. onprogress nsidomeventlistener a javascript function object that gets invoked zero or more times, after the loadstart event, but before any abort, error, or load events occur. handling the events when the handler functions for these events are called, they receive as a parameter a progressevent, which implements the nsidomprogressevent interface. see also using xmlhttprequest xmlhttprequest nsixmlhttprequest nsidomprogressevent ...
nsIXPCScriptable
should be allocated and stored in statep. you can use private_to_jsval() to tag the pointer to be stored. if idp is non-null, and provided the number of enumerable properties is known, the number of properties that will be enumerated should be returned as an integer jsval in idp. if idp is non-null and the number of enumerable properties cannot be computed in advance, idp should be set to jsval_zero. your function might be passed a null pointer for idp. jsenumerate_next a previously allocated opaque iterator state is passed in via statep. return the next jsid in the iteration using idp. the opaque iterator state pointed at by statep is destroyed and *statep is set to jsval_null if there are no properties left to enumerate. jsenumerate_destroy this function should destroy the opaque itera...
nsIXPConnect
ype missing description exceptions thrown missing exception missing description native code only!setdebugmodewhenpossible when we place the browser in js debug mode, there can't be any js on the stack. this is because we currently activate debugmode on all scripts in the jsruntime when the debugger is activated. this method will turn debug mode on or off when the context stack reaches zero length. void setdebugmodewhenpossible( in prbool mode ); parameters mode missing description exceptions thrown missing exception missing description setdefaultsecuritymanager() the security manager to use when the current jscontext has no security manager. void setdefaultsecuritymanager( in nsixpcsecuritymanager amanager, in pruint16 flags ); parameters amanager missi...
nsMsgFolderFlagType
newshost = 0x00000002; /// this folder is a mail folder. const nsmsgfolderflagtype mail = 0x00000004; /** @} */ /** whether this is a directory: newshosts are always directories; * newsgroups can be directories if we are in ``show all groups'' mode; * mail folders will have this bit if they are really directories, not files. * (note that directories may have zero children.) */ const nsmsgfolderflagtype directory = 0x00000008; /** whether the children of this folder are currently hidden in the listing. * this will only be present if the nsmsgfolderflags::directory bit is on. */ const nsmsgfolderflagtype elided = 0x00000010; /// whether this is a virtual search folder const nsmsgfolderflagtype virtual = 0x00000020;...
NS_CStringContainerInit2
object. this parameter may be null. adatalength [in] an optional parameter that specifies the length of the array pointed to by adata. pass pr_uint32_max to indicate that adata's length may be determined by scanning the string for a terminating null. if adata is null, then this parameter is ignored. aflags [in] a bit-field that modifies how the string object is initialized. if this value is zero, then the array referenced by adata (if any) will be copied. flag values are defined below. flag values the aflags parameter is a bit-wise combination of the following values: ns_cstring_container_init_depend data passed into ns_cstringcontainerinit2 is not copied. instead, the string references the passed in data pointer directly. the caller must ensure that the data is valid for the lifet...
NS_CStringGetMutableData
ify. adatalength [in] the number of characters to resize the string's internal buffer to or pr_uint32_max to return the buffer as-is. adata [out] upon return, if the function was successful, then *adata references the string's internal buffer. return values this function returns the number of characters contained in the string's internal buffer (excluding any null-terminator). this value will be zero if the function failed to resize its internal buffer to the size requested. remarks this function provides mutable access to a string's internal buffer. it returns a pointer to the first element of an array of characters that may be modified in-place. the returned pointer remains valid until the string object is passed to some other string function. this function does not necessarily null-termina...
nsIAbCard/Thunderbird3
utf8string getpropertyasautf8string(in string name); [noscript] pruint32 getpropertyasuint32(in string name); [noscript] boolean getpropertyasbool(in string name); returns a property for the given name. these functions convert values in the same manner as the default implementation of nsivariant. of particular note is that boolean variables are converted to integers as in c/c++ (true is a non-zero value), so that false will be converted to a string of 0 and not false<code>. these functions are marked <code>[noscript] since xpcconnect performs automatic type conversion on nsivariant such that they are not needed for scripts, only for c++ callers. parameters name the case-sensitive name of the property to get. return value the value of the attribute asked for. exceptions thrown...
Storage
ceholder called "parameter" to be bound later (described in binding parameters). similarly, the c++ looks like this: nscomptr<mozistoragestatement> statement; rv = dbconn->createstatement(ns_literal_cstring("select * from table_name where column_name = ?1"), getter_addrefs(statement)); ns_ensure_success(rv, rv); this example uses the numbered placeholder indexed by zero for a parameter to be bound later (described in binding parameters). note: numerical indexes for parameters are always one less than the number you write in the sql. the use of numerical indexes for parameters is strongly discouraged in javascript where named parameters are much easier to use. note: if you need to execute a statement multiple times, caching the result of createstatement will gi...
Getting Started Guide
ved from that abstract base class. the xpcom object is said to `implement that interface'. the client's reference to the object is typically called `an interface pointer'. an object may implement many interfaces. each interface is (at least conceptually) separately `reference counted'. that is, the interface keeps a count of the number of clients holding references to it. when that count goes to zero, the interface may delete itself. clients are expected to keep this reference count accurate by incrementing it when they acquire a reference to the interface, and decrementing it before they let go. to facilitate this, all interfaces inherit from an abstract base class that provides the member functions addref, and release. a rule of xpcom is that any function that creates or returns an interfa...
Xptcall Porting Guide
orrect stack pointer fixup for return without fail, else the process will crash. i opted to use inline assembler for the gcc linux x86 port. i ended up with larger stubs than i would have preferred rather than battle the compiler over what would happen to the stack before my asm code began running. i believe that the non-assembly parts of these files can be copied and reused with minimal (but not zero) platform specific tweaks. feel free to copy and paste as necessary. please remember that safety and reliability are more important than speed optimizations. this code is primarily used to connect xpcom components with javascript; function call overhead is a tiny part of the time involved. i put together xptcall/src/md/test as a place to evolve the basic functionality as a port is coming together...
Building a Thunderbird extension 6: Adding JavaScript
the first part registers a new event listener that will be executed automatically when thunderbird loads. the event listener then calls our startup function which gets our <statusbarpanel>-element with the id my-panel from the document's dom tree. it then uses javascript's date class to get the current date, which it converts into a string that has the format of yyyy.mm.dd. because the month is zero-based we also need to add one to the month. finally the label of our panel is set to "date: " and concatenated with the date string that contains the formatted date. we use the function window.setinterval to update the date in case thunderbird is left running for more than one day. this allows us to call the startup function repeatedly with an interval of 60000ms (every minute). further documen...
Using popup notifications
tion information: this lets the user decide whether or not to share their location when it's convenient to do so, instead of being compelled to do it at once. in addition, notifications can be dismissed and recalled by clicking anywhere outside the notification, then clicking on the notification icon to bring it back again. a popup notification can include a text message, a button action, and zero or more additional actions provided in a drop-down menu accessed through the notification's button. creating a popup notification popup notifications can be created using the popupnotifications.jsm javascript code module. this code module is imported by the browser, so you don't need to do it explicitly yourself. then you can create the popup notification at the appropriate time like this: po...
Working with data
about creating new cdata objects. creating uninitialized cdata objects there are three forms of the syntax for creating cdata objects without immediately assigning them a value: var mycdataobj = new type; var mycdataobj = new type(); var mycdataobj = type(); these all do the same thing: they return a new cdata object of the specified type, whose data buffer has been populated entirely with zeroes. note: if type.size is undefined, creating a new object this way will throw a typeerror exception. creating initialized cdata objects similarly, you can initialize cdata objects with specific values at the type of creation by specifying them as a parameter when calling the ctype's constructor, like this: var mycdataobj = new type(value); var mycdataobj = type(value); if the size of the sp...
FunctionType
functiontype represents c function. syntax returns a new ctype object describing a c function. ctype functiontype( abi, returntype[, argtype1, ...] ); parameters abi the abi type for the function; this is one of the abi constants. returntype a ctype indicating the type of the value returned by the function. argtype1... argtypen zero or more ctype objects indicating the types of each of the parameters passed into the c function. return value a ctype describing the function type. the equivalent c function type declaration would be: returntype (*) ([argtype1, ..., argtypen]); exceptions thrown typeerror abi is not a valid abi constants, or returntype or any of the argument types are not valid ctype objects. properties property type descripti...
Library
t_abi for most libraries, except for windows libraries, which will be ctypes.winapi_abi or ctypes.stdcall_abi. see abi constants. you don't need to provide this for exported data; it's only needed for function declarations. returntype the ctype type returned by the defined api, if it's a function. this parameter should not be provided if the api is an exported data symbol. argtype1...argtypen zero or more parameter ctype may be specified for the parameters of the function being declared. these should not be provided if the api is an exported data symbol rather than a function. return value a functiontype cdata object representing the declared api. exceptions thrown ctypes ctype functiontype abi typeerror the return type was specified as an array. alternative syntax anothe...
Debugger.Frame - Firefox Developer Tools
rame running in webassembly baseline jit. this the value of this for this frame (a debuggee value). for a wasmcall frame, this property throws a typeerror. older the next-older visible frame, in which control will resume when this frame completes. if there is no older frame, this is null. depth the depth of this frame, counting from oldest to youngest; the oldest frame has a depth of zero. live true if the frame this debugger.frame instance refers to is still on the stack; false if it has completed execution or been popped in some other way. script the script being executed in this frame (a debugger.script instance), or null on frames that do not represent calls to debuggee code. on frames whose callee property is not null, this is equal to callee.script. offset the offset o...
Debugger.Script - Firefox Developer Tools
source code from which this script was produced. this is null if the source code was not retained. if the instance refers to webassembly code, the debugger.source instance representing the serialized text format of the webassembly code. sourcestart if the instance refers to a jsscript, the character within the debugger.source instance given by source at which this script’s code starts; zero-based. if this is a function’s script, this is the index of the start of the function token in the source code. if the instance refers to webassembly code, throw a typeerror. sourcelength if the instance refers to a jsscript, the length, in characters, of this script’s code within the debugger.source instance given by source. if the instance refers to webassembly code, throw a typee...
Examine and edit HTML - Firefox Developer Tools
ml elements because it makes markup more readable. usually this white space seems to have no effect and no visual output, but in fact, when a browser parses html it will automatically generate anonymous text nodes for elements not contained in a node. this includes white space (which is after all a type of text). if these auto generated text nodes are inline level, browsers will give them a non-zero width and height. then you will find strange gaps between elements, even if you haven’t set any margin or padding on them. since firefox 52, the inspector displays these whitespace nodes, so you can see where the gaps in your markup come from. whitespace nodes are represented with a dot: and you get an explanatory tooltip when you hover over them: to see this in action, see the demo at htt...
Web Audio Editor - Firefox Developer Tools
ails, see deprecated tools. with the web audio api, developers create an audio context. within that context they then construct a number of audio nodes, including: nodes providing the audio source, such as an oscillator or a data buffer source nodes performing transformations such as delay and gain nodes representing the destination of the audio stream, such as the speakers each node has zero or more audioparam properties that configure its operation. for example, the gainnode has a single gain property, while the oscillatornode has frequency and detune properties. the developer connects the nodes in a graph, and the complete graph defines the behavior of the audio stream. the web audio editor examines an audio context constructed in the page and provides a visualization of its grap...
AbstractRange.collapsed - Web APIs
the collapsed read-only property of the abstractrange interface returns true if the range's start position and end position are the same. syntax var iscollpased = range.collapsed value a boolean value which is true if the range is collapsed. a collapsed range is one in which the start and end positions are the same, resulting in a zero-character-long range.. specifications specification status comment domthe definition of 'collapsed' in that specification. living standard static rangethe definition of 'collapsed' in that specification. editor's draft initial definition. ...
Animation.updatePlaybackRate() - Web APIs
t produce a sharp jump. after calling updateplaybackrate() the animation's playbackrate is not immediately updated. it will be updated once the animation's ready promise is resolved. syntax animation.updateplaybackrate(2); parameters playbackrate the new speed to set. this may be a positive number (to speed up or slow down the animation), a negative number (to make it play backwards), or zero (to effectively pause the animation). return value none. examples a speed selector component would benefit from smooth updating of updateplaybackrate(), as demonstrated below: speedselector.addeventlistener('input', evt => { cartoon.updateplaybackrate(parsefloat(evt.target.value)); cartoon.ready.then(() => { console.log(`playback rate set to ${cartoon.playbackrate}`); }); }); ...
AudioContext() - Web APIs
the audiocontext() constructor creates a new audiocontext object which represents an audio-processing graph, built from audio modules linked together, each represented by an audionode. syntax var audioctx = new audiocontext(); var audioctx = new audiocontext(options); parameters options optional an object based on the audiocontextoptions dictionary that contains zero or more optional properties to configure the new context. available properties are as follows: latencyhint optional the type of playback that the context will be used for, as a value from the audiocontextlatencycategory enum or a double-precision floating-point value indicating the preferred maximum latency of the context in seconds. the user agent may or may not choose to meet this request; check the value of audiocon...
AudioNode - Web APIs
Web › API › AudioNode
0095dd; pointer-events: all;} note: an audionode can be target of events, therefore it implements the eventtarget interface. description the audio routing graph each audionode has inputs and outputs, and multiple audio nodes are connected to build a processing graph. this graph is contained in an audiocontext, and each audio node can only belong to one audio context. a source node has zero inputs but one or multiple outputs, and can be used to generate sound. on the other hand, a destination node has no outputs; instead, all its inputs are directly played back on the speakers (or whatever audio output device the audio context uses). in addition, there are processing nodes which have inputs and outputs. the exact processing done varies from one audionode to another but, in general, ...
AudioScheduledSourceNode - Web APIs
an audioscheduledsourcenode object directly. instead, use the interface which extends it, such as audiobuffersourcenode, oscillatornode, and constantsourcenode. unless stated otherwise, nodes based upon audioscheduledsourcenode output silence when not playing (that is, before start() is called and after stop() is called). silence is represented, as always, by a stream of samples with the value zero (0). properties inherits properties from its parent interface, audionode. methods inherits methods from its parent interface, audionode, and adds the following methods: start() schedules the node to begin playing the constant sound at the specified time. if no time is specified, the node begins playing immediately. stop() schedules the node to stop playing at the specified time. if no t...
AudioWorkletNode() - Web APIs
ameters context the baseaudiocontext instance this node will be associated with. name a string, which represents the name of the audioworkletprocessor this node will be based on. a processor with the provided name must first be registered using the audioworkletglobalscope.registerprocessor() method. options optional an object based on the audioworkletnodeoptions dictionary, which contains zero or more optional properties to configure the new node. the result of the structured clone algorithm applied to the object is also internally passed into the associated audioworkletprocessor() constructor — this allows custom initialization of an underlying user-defined audioworkletprocessor. available properties are as follows: numberofinputs optional the value to initialize the numberofinpu...
Background Tasks API - Web APIs
this example will create a random number of tasks (between 100 and 200 of them). to do so, we use the getrandomintinclusive() function that's provided as an example in the d...
BaseAudioContext.createIIRFilter() - Web APIs
pulse response (iir) filter which can be configured to serve as various types of filter. syntax var iirfilter = audiocontext.createiirfilter(feedforward, feedback); parameters feedforward an array of floating-point values specifying the feedforward (numerator) coefficients for the transfer function of the iir filter. the maximum length of this array is 20, and at least one value must be nonzero. feedback an array of floating-point values specifying the feedback (denominator) coefficients for the transfer function of the iir filter. this array may have up to 20 members, the first of which must not be zero. return value an iirfilternode implementing the filter with the specified feedback and feedforward coefficient arrays. exceptions invalidstateerror all of the feedforward coef...
BaseAudioContext.createScriptProcessor() - Web APIs
e's input, defaults to 2. values of up to 32 are supported. numberofoutputchannels integer specifying the number of channels for this node's output, defaults to 2. values of up to 32 are supported. important: webkit currently (version 31) requires that a valid buffersize be passed when calling this method. note: it is invalid for both numberofinputchannels and numberofoutputchannels to be zero. returns a scriptprocessornode. example the following example shows basic usage of a scriptprocessornode to take a track loaded via audiocontext.decodeaudiodata(), process it, adding a bit of white noise to each audio sample of the input track (buffer) and play it through the audiodestinationnode. for each channel and each sample frame, the scriptnode.onaudioprocess function takes the associ...
BlobEvent.timecode - Web APIs
syntax var timecode = blobevent.timecode value a domhighrestimestamp. ...
BlobEvent - Web APIs
Web › API › BlobEvent
with the event. the event was fired on the eventtarget because of something happening on that specific blob. blobevent.timecode read only a domhighrestimestamp indicating the difference between the timestamp of the first chunk in data and the timestamp of the first chunk in the first blobevent produced by this recorder. note that the timecode in the first produced blobevent does not need to be zero. methods no specific method; inherits methods from its parent event. specifications specification status comment mediastream recordingthe definition of 'blobevent' in that specification. working draft initial definition. ...
CSSStyleDeclaration.item() - Web APIs
ation.item() method interface returns a css property name from a cssstyledeclaration by index. this method doesn't throw exceptions as long as you provide arguments; the empty string is returned if the index is out of range and a typeerror is thrown if no argument is provided. syntax var propertyname = style.item(index); parameters index is the index of the node to be fetched. the index is zero-based. return value propertyname is a domstring that is the name of the css property at the specified index. javascript has a special simpler syntax for obtaining an item from a nodelist by index: var propertyname = style[index]; example var style = document.getelementbyid('div1').style; var propertyname = style.item(1); // or simply style[1] - returns the second style listed specific...
CSSStyleSheet.insertRule() - Web APIs
nged selectorandrule.substring(0, openbracketpos), // the selector selectorandrule.substring(closebracketpos), // the rule arguments[3] // the insert index ); } // works by if the char code is a backslash, then isescaped // gets flipped (xor-ed by 1), and if it is not a backslash // then isescaped gets xored by itself, zeroing it isescaped ^= newcharcode===92?1:isescaped; // 92 = "\\".charcodeat(0) } // else, there is no unescaped bracket return originalinsertrule.call(this, selectorandrule, "", arguments[2]); }; } })(cssstylesheet.prototype); specifications specification status comment css object model (cssom)the definition of 'cssstylesheet.insertrule' in ...
CanvasRenderingContext2D.addHitRegion() - Web APIs
seeing it. syntax void ctx.addhitregion(options); options the options argument is optional. when provided, it is an object which can contain the following properties: path a path2d object describing the area of the hit region. if not provided, the current path is used. fillrule the algorithm by which to determine if a point is inside or outside the hit region. possible values: nonzero: the non-zero winding rule. default rule. evenodd: the even-odd winding rule. id the id for this hit region to reference it for later use in events, for example. parentid the id of the parent region for cursor fallback and navigation by accessibility tools. cursor the cursor to use when the mouse is over this region (defaults to inherit). inherits the cursor of the parent hit region, ...
CanvasRenderingContext2D.createImageData() - Web APIs
. a negative value flips the rectangle around the horizontal axis. imagedata an existing imagedata object from which to copy the width and height. the image itself is not copied. return value a new imagedata object with the specified width and height. the new object is filled with transparent black pixels. errors thrown indexsizeerror thrown if either of the width or height arguments is zero. examples creating a blank imagedata object this snippet creates a blank imagedata object using the createimagedata() method. html <canvas id="canvas"></canvas> javascript the generated object is 100 pixels wide and 50 pixels tall, making 5,000 pixels in all. each pixel within an imagedata object consists of four array values, so the object's data property has a length of 4 × 5,000, or...
CanvasRenderingContext2D.drawImage() - Web APIs
n the destination canvas. this allows scaling of the drawn image. if not specified, the image is not scaled in width when drawn. dheight optional the height to draw the image in the destination canvas. this allows scaling of the drawn image. if not specified, the image is not scaled in height when drawn. exceptions thrown index_size_err if the canvas or source rectangle width or height is zero. invalid_state_err the image has no image data. type_mismatch_err the specified source element isn't supported. ns_error_not_available the image is not loaded yet. use .complete === true and .onload to determine when it is ready. examples drawing an image to the canvas this example draws an image to the canvas using the drawimage() method. html <canvas id="canvas"></canvas> <div style...
CanvasRenderingContext2D.getImageData() - Web APIs
rectangle from which the imagedata will be extracted. positive values are down, and negative are up. return value an imagedata object containing the image data for the rectangle of the canvas specified. the coordinates of the rectangle's top-left corner are (sx, sy), while the coordinates of the bottom corner are (sx + sw, sy + sh). exceptions indexsizeerror thrown if either sw or sh are zero. securityerror the canvas contains or may contain pixels which were loaded from an origin other than the one from which the document itself was loaded. to avoid securityerror being thrown in this situation, configure cors to allow the source image to be used in this way. see allowing cross-origin use of images and canvas. example getting image data from a canvas this example draws a rectang...
CanvasRenderingContext2D.isPointInPath() - Web APIs
, fillrule]); ctx.ispointinpath(path, x, y [, fillrule]); parameters x the x-axis coordinate of the point to check, unaffected by the current transformation of the context. y the y-axis coordinate of the point to check, unaffected by the current transformation of the context. fillrule the algorithm by which to determine if a point is inside or outside the path. possible values: "nonzero": the non-zero winding rule. default rule. "evenodd": the even-odd winding rule. path a path2d path to check against. if unspecified, the current path is used. return value boolean a boolean, which is true if the specified point is contained in the current or specified path, otherwise false. examples checking a point in the current path this example uses the ispointinpath() meth...
CanvasRenderingContext2D.lineJoin - Web APIs
the canvasrenderingcontext2d.linejoin property of the canvas 2d api determines the shape used to join two line segments where they meet. this property has no effect wherever two connected segments have the same direction, because no joining area will be added in this case. degenerate segments with a length of zero (i.e., with all endpoints and control points at the exact same position) are also ignored. note: lines can be drawn with the stroke(), strokerect(), and stroketext() methods. syntax ctx.linejoin = "bevel" || "round" || "miter"; options there are three possible values for this property: "round", "bevel", and "miter". the default is "miter". "round" rounds off the corners of a shape by filling an additional sector of disc centered at the common endpoint of connected seg...
CanvasRenderingContext2D.lineWidth - Web APIs
this value is 1.0 by default. examples changing line width this example draws a line and a rectangle, using a line width of 15 units. ...
CanvasRenderingContext2D.miterLimit - Web APIs
the default value is 10.0. ...
CanvasRenderingContext2D.shadowBlur - Web APIs
the canvasrenderingcontext2d.shadowblur property of the canvas 2d api specifies the amount of blur applied to shadows. the default is 0 (no blur). note: shadows are only drawn if the shadowcolor property is set to a non-transparent value. one of the shadowblur, shadowoffsetx, or shadowoffsety properties must be non-zero, as well. syntax ctx.shadowblur = level; level a non-negative float specifying the level of shadow blur, where 0 represents no blur and larger numbers represent increasingly more blur. this value doesn't correspond to a number of pixels, and is not affected by the current transformation matrix. the default value is 0. negative, infinity, and nan values are ignored. examples adding a shadow to a shape this example adds a blurred shadow to a rectangle. the shadowco...
CanvasRenderingContext2D.shadowColor - Web APIs
owcolor property of the canvas 2d api specifies the color of shadows. be aware that the shadow's rendered opacity will be affected by the opacity of the fillstyle color when filling, and of the strokestyle color when stroking. note: shadows are only drawn if the shadowcolor property is set to a non-transparent value. one of the shadowblur, shadowoffsetx, or shadowoffsety properties must be non-zero, as well. syntax ctx.shadowcolor = color; color a domstring parsed as a css <color> value. the default value is fully-transparent black. examples adding a shadow to shapes this example adds a shadow to two squares; the first one is filled, and the second one is stroked. the shadowcolor property sets the shadows' color, while shadowoffsetx and shadowoffsety set their position relative ...
CanvasRenderingContext2D.shadowOffsetX - Web APIs
syntax ctx.shadowoffsetx = offset; offset a float specifying the distance that shadows will be offset horizontally. ...
CanvasRenderingContext2D.shadowOffsetY - Web APIs
syntax ctx.shadowoffsety = offset; offset a float specifying the distance that shadows will be offset vertically. positive values are down, and negative are up. ...
CanvasRenderingContext2D.stroke() - Web APIs
syntax void ctx.stroke(); void ctx.stroke(path); parameters path a path2d path to stroke. ...
CanvasRenderingContext2D - Web APIs
he canvas. the contents of the window's viewport are rendered, ignoring viewport clipping and scrolling. canvasrenderingcontext2d.demote() this causes a context that is currently using a hardware-accelerated backend to fallback to a software one. all state should be preserved. internet explorer canvasrenderingcontext2d.msfillrule the fill rule to use. this must be one of evenodd or nonzero (default). specifications specification status comment html living standardthe definition of 'canvasrenderingcontext2d' in that specification. living standard ...
Manipulating video using canvas - Web APIs
lling out the red, green, and blue values for each pixel, and compares the values against predetermined numbers that are used to detect the green screen that will be replaced with the still background image imported from foo.png. every pixel in the frame's image data that is found that is within the parameters that are considered to be part of the green screen has its alpha value replaced with a zero, indicating that the pixel is entirely transparent. as a result, the final image has the entire green screen area 100% transparent, so that when it's drawn into the destination context in line 13, the result is an overlay onto the static backdrop. the resulting image looks like this: this is done repeatedly as the video plays, so that frame after frame is processed and displayed with the chr...
Pixel manipulation with canvas - Web APIs
ngth attribute: var numbytes = imagedata.data.length; creating an imagedata object to create a new, blank imagedata object, you should use the createimagedata() method. there are two versions of the createimagedata() method: var myimagedata = ctx.createimagedata(width, height); this creates a new imagedata object with the specified dimensions. all pixels are preset to transparent black (all zeroes i.e rgba(0,0,0,0)). you can also create a new imagedata object with the same dimensions as the object specified by anotherimagedata. the new object's pixels are all preset to transparent black. this does not copy the image data! var myimagedata = ctx.createimagedata(anotherimagedata); getting the pixel data for a context to obtain an imagedata object containing a copy of the pixel data for ...
console.assert() - Web APIs
Web › API › Console › assert
onsole.assert(assertion, msg [, subst1, ..., substn]); // c-like message formatting parameters assertion any boolean expression. if the assertion is false, the message is written to the console. obj1 ... objn a list of javascript objects to output. the string representations of each of these objects are appended together in the order listed and output. msg a javascript string containing zero or more substitution strings. subst1 ... substn javascript objects with which to replace substitution strings within msg. this parameter gives you additional control over the format of the output. examples the following code example demonstrates the use of a javascript object following the assertion: const errormsg = 'the # is not even'; for (let number = 2; number <= 5; number += 1) { ...
Console.countReset() - Web APIs
ven code like this: let user = ""; function greet() { console.count(); return "hi " + user; } user = "bob"; greet(); user = "alice"; greet(); greet(); console.count(); console.countreset(); console output will look something like this: "default: 1" "default: 2" "default: 3" "default: 4" "default: 0" note that the call to console.counterreset() resets the value of the default counter to zero. if we pass the user variable as the label argument with the string "bob" to the first invocation of count(), and the string "alice" to the second: let user = ""; function greet() { console.count(user); return "hi " + user; } user = "bob"; greet(); user = "alice"; greet(); greet(); console.countreset("bob"); console.count("alice"); we will see output like this: "bob: 1" "alice: 1" "alic...
console.debug() - Web APIs
Web › API › Console › debug
ed to display debug output. note: this feature is available in web workers. syntax console.debug(obj1 [, obj2, ..., objn]); console.debug(msg [, subst1, ..., substn]); parameters obj1 ... objn a list of javascript objects to output. the string representations of each of these objects are appended together in the order listed and output to the console. msg a javascript string containing zero or more substitution strings, which are replaced with subst1 through substn in consecutive order. subst1 ... substn javascript objects with which to replace substitution strings within msg. this gives you additional control over the format of the output. see using string substitutions in console for a description of how substitutions work. see outputting text to the console in the documentati...
Console.error() - Web APIs
Web › API › Console › error
nsole.exception(obj1 [, obj2, ..., objn]); console.exception(msg [, subst1, ..., substn]); note: console.exception() is an alias for console.error(); they are functionally identical. parameters obj1 ... objn a list of javascript objects to output. the string representations of each of these objects are appended together in the order listed and output. msg a javascript string containing zero or more substitution strings. subst1 ... substn javascript objects with which to replace substitution strings within msg. this gives you additional control over the format of the output. see outputting text to the console in the documentation of console for details. specifications specification status comment console apithe definition of 'console.error()' in that...
Console.info() - Web APIs
Web › API › Console › info
ext to these items in the web console's log. note: this feature is available in web workers. syntax console.info(obj1 [, obj2, ..., objn]); console.info(msg [, subst1, ..., substn]); parameters obj1 ... objn a list of javascript objects to output. the string representations of each of these objects are appended together in the order listed and output. msg a javascript string containing zero or more substitution strings. subst1 ... substn javascript objects with which to replace substitution strings within msg. this gives you additional control over the format of the output. see outputting text to the console in the documentation of console for details. specifications specification status comment console apithe definition of 'console.info()' in that ...
console.log() - Web APIs
Web › API › Console › log
ded together in the order listed and output. please be warned that if you log objects in the latest versions of chrome and firefox what you get logged on the console is a reference to the object, which is not necessarily the 'value' of the object at the moment in time you call console.log(), but it is the value of the object at the moment you open the console. msg a javascript string containing zero or more substitution strings. subst1 ... substn javascript objects with which to replace substitution strings within msg. this gives you additional control over the format of the output. see outputting text to the console in the documentation of console for details. difference between log() and dir() you might ask yourself what's the difference between console.dir() and console.log(). anot...
console.trace() - Web APIs
Web › API › Console › trace
these are assembled and formatted the same way they would be if passed to the console.log() method. ...
Console.warn() - Web APIs
Web › API › Console › warn
nd firefox, warnings have a small exclamation point icon next to them in the web console log. syntax console.warn(obj1 [, obj2, ..., objn]); console.warn(msg [, subst1, ..., substn]); parameters obj1 ... objn a list of javascript objects to output. the string representations of each of these objects are appended together in the order listed and output. msg a javascript string containing zero or more substitution strings. subst1 ... substn javascript objects with which to replace substitution strings within msg. this gives you additional control over the format of the output. see outputting text to the console in the documentation of console for details. specifications specification status comment console apithe definition of 'console.warn()' in that ...
console - Web APIs
Web › API › Console
of these results in output styled differently in the log, and you can use the filtering controls provided by your browser to only view the kinds of output that interest you. there are two ways to use each of the output methods; you can simply pass in a list of objects whose string representations get concatenated into one string, then output to the console, or you can pass in a string containing zero or more substitution strings followed by a list of objects to replace them. outputting a single object the simplest way to use the logging methods is to output a single object: var someobject = { str: "some text", id: 5 }; console.log(someobject); the output looks something like this: [09:27:13.475] ({str:"some text", id:5}) outputting multiple objects you can also output multiple objects...
DOMPoint - Web APIs
Web › API › DOMPoint
is based on dompointreadonly but allows its properties' values to be changed. in general, a positive x component represents a position to the right of the origin, a positive y component is downward from the origin, and a positive z component extends outward from the screen (in other words, toward the user). constructor dompoint() creates and returns a new dompoint object given the values of zero or more of its coordinate components and optionally the w perspective value. you can also use an existing dompoint or dompointreadonly or a dompointinit dictionary to create a new point by calling the dompoint.frompoint() static method. methods dompoint inherits methods from its parent, dompointreadonly. static methods dompoint.frompoint() creates a new mutable dompoint object given a...
DataTransfer.mozClearDataAt() - Web APIs
if the format argument is not provided, then the data associated with all formats is removed. if the format is not found, then this method has no effect. if the last format for the item is removed, the entire item is removed, reducing mozitemcount by one. removing the last format for a particular index removes that item entirely, shifting the remaining items down and changing their indices. ...
DataTransfer.mozGetDataAt() - Web APIs
note: this method is gecko-specific. syntax nsivariant datatransfer.mozgetdataat([type], index); arguments type a string representing the type of the drag data to retrieve from the drag data object. ...
DataTransfer.mozSetDataAt() - Web APIs
mozsetdataat() may only be called with an index argument less than mozitemcount in which case an existing item is modified, or equal to mozitemcount in which case a new item is added, and the mozitemcount is incremented by one. data should be added in order of preference, with the most specific format added first and the least specific format added last. ...
DataTransfer - Web APIs
ge() set the image to be used for dragging if a custom one is desired. gecko methods note: all of the methods in this section are gecko-specific. datatransfer.addelement() sets the drag source to the given element. deprecated methods datatransfer.mozcleardataat() removes the data associated with the given format for an item at the specified index. the index is in the range from zero to the number of items minus one. removed in firefox 71. datatransfer.mozgetdataat() retrieves the data associated with the given format for an item at the specified index, or null if it does not exist. the index should be in the range from zero to the number of items minus one. removed in firefox 71. datatransfer.mozsetdataat() a data transfer may store multiple items, each at a given ze...
DataTransferItemList.DataTransferItem() - Web APIs
the datatransferitem() getter method implements support for accessing items in the datatransferitemlist using array-style syntax (that is datatransferitem[index]). syntax dataitem = datatransferitem[index]; parameters index the zero-based index of the item in the drag data list to return. return value the datatransferitem object at the specified index in the item list. if the index is less than zero or greater than or equal to the number of items in the list (as indicated by the list's length property, undefined is returned. the returned value is never null. example this example shows how to use drag and drop. javascript function dragstart_handler(ev) { console.log("dragstart"); // add this element's id to the drag payload so the drop handler will // know which element to...
DeviceProximityEvent - Web APIs
the deviceproximityevent interface provides information about the distance of a nearby physical object using the proximity sensor of a device. properties deviceproximityevent.max read only the maximum sensing distance the sensor is able to report, in centimeters. deviceproximityevent.min read only the minimum sensing distance the sensor is able to report, in centimeters. ususally zero. deviceproximityevent.value read only the current device proximity, in centimeters. examples window.addeventlistener('deviceproximity', function(event) { console.log("value: " + event.value, "max: " + event.max, "min: " + event.min); }); ...
Document.cookie - Web APIs
Web › API › Document › cookie
vil-domain.com/steal-cookie.php?cookie=" + document.cookie; the httponly cookie attribute can help to mitigate this attack by preventing access to cookie value through javascript. read more about cookies and security. notes starting with firefox 2, a better mechanism for client-side storage is available - whatwg dom storage. you can delete a cookie by simply updating its expiration time to zero. keep in mind that the more cookies you have, the more data will be transferred between the server and the client for each request. this will make each request slower. it is highly recommended for you to use whatwg dom storage if you are going to keep "client-only" data. rfc 2965 (section 5.3, "implementation limits") specifies that there should be no maximum length of a cookie's key or value s...
Document.createTouchList() - Web APIs
note: firefox also accepts an array of touch objects. return value list a touchlist object containing the touch objects specified by the touches parameter. ...
Document.forms - Web APIs
Web › API › Document › forms
: similarly, you can access a list of a form's component user input elements using the htmlformelement.elements property. syntax collection = document.forms; value an htmlcollection object listing all of the document's forms. each item in the collection is a htmlformelement representing a single <form> element. if the document has no forms, the returned collection is empty, with a length of zero. examples getting form information <!doctype html> <html lang="en"> <head> <title>document.forms example</title> </head> <body> <form id="robby"> <input type="button" onclick="alert(document.forms[0].id);" value="robby's form" /> </form> <form id="dave"> <input type="button" onclick="alert(document.forms[1].id);" value="dave's form" /> </form> <form id="paul"> <input type="button" o...
Document.timeline - Web APIs
Web › API › Document › timeline
ent interface represents the default timeline of the current document. this timeline is a special instance of documenttimeline that is automatically created on page load. this timeline is unique to each document and persists for the lifetime of the document including calls to document.open(). the time values for this timeline are calculated as a fixed offset from the global clock such that the zero time corresponds to the navigationstart moment plus a signed delta known as the origin time. prior to establishing the navigationstart moment, the document timeline is inactive. note: a document timeline that is associated with a non-active document is also considered to be inactive. syntax var pagetimeline = document.timeline; var thismoment = pagetimeline.currenttime; value a documentt...
DocumentTimeline.DocumentTimeline() - Web APIs
documenttimeline() constructor of the web animations api creates a new instance of the documenttimeline object associated with the active document of the current browsing context. syntax var sharedtimeline = new documenttimeline(options); parameters options an object specifying options for the new timeline. currently the only supported option is the origintime member which specifies the zero time for the documenttimeline as a real number of milliseconds relative to the navigationstart moment of the active document for the current browsing context. examples we could share a single documenttimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. this bit of code would start all the cats animating 500 milliseconds int...
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
all of the element's descendants matching the tag name. the first element of the list is located at position [0] in the array. ...
EffectTiming.duration - Web APIs
alue (including positive infinity). currently, a value of "auto" is the same as specifying 0.0. this is a forwards-compatiblity measure since in the future, "auto" will be expanded to take into account the duration of any child effects. consider using "auto" rather than 0 if that makes sense. exceptions typeerror the specified value is either a string other than "auto", a number less than zero, nan, or some other type of object entirely. examples in the pool of tears example, each tear is passed a random duration via its timing object: // randomizer function var getrandommsrange = function(min, max) { return math.random() * (max - min) + min; } // loop through each tear tears.foreach(function(el) { // animate each tear el.animate( tearsfalling, { delay: getr...
Element.clientHeight - Web APIs
it includes padding but excludes borders, margins, and horizontal scrollbars (if present). clientheight can be calculated as: css height + css padding - height of horizontal scrollbar (if present). when clientheight is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's height (excluding any scrollbar) is returned. this is a special case of clientheight. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). ...
Element.clientTop - Web APIs
Web › API › Element › clientTop
ecause the offsettop indicates the location of the top of the border (not the margin) while the client area starts immediately below the border, (client area includes padding.) therefore, the clienttop value will always equal the integer portion of the .getcomputedstyle() value for "border-top-width". (actually might be math.round(parsefloat()).) for example, if the computed "border-top-width" is zero, then clienttop is also zero. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). gecko-based applications support clienttop starting with gecko 1.9 (firefox 3, implemented in bug 111207). this property is not supported in firefox 2 and earlier. syntax var top = element.clienttop; example in the following illustrati...
Element.clientWidth - Web APIs
it includes padding but excludes borders, margins, and vertical scrollbars (if present). when clientwidth is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's width (excluding any scrollbar) is returned. this is a special case of clientwidth. note: this property will round the value to an integer. if you need a fractional value, use element.getboundingclientrect(). syntax var intelemclientwidth = element.clientwidth; intelemclientwidth is an integer corresponding to the clientwidth of element in pixels. the clientwidth property is read–only. ...
Element.currentStyle - Web APIs
sions of microsoft internet explorer. however, it returns the units set in css while window.getcomputedstyle() returns the values in pixels. polyfill this polyfill returns the values in pixels and is likely to be rather slow, as it has to call window.getcomputedstyle() every time its value is read. /* any copyright is dedicated to the public domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ if (!("currentstyle" in element.prototype)) { object.defineproperty(element.prototype, "currentstyle", { get: function() { return window.getcomputedstyle(this); } }); } specification not part of any specification. microsoft had a description on msdn. browser compatibility the compatibility table on this page is generated from structured data. if you'd like to cont...
Element.getBoundingClientRect() - Web APIs
t rectangle which contains the entire element, with read-only left, top, right, bottom, x, y, width, and height properties describing the overall border-box in pixels. properties other than width and height are relative to the top-left of the viewport. empty border-boxes are completely ignored. if all the element's border-boxes are empty, then a rectangle is returned with a width and height of zero and where the top and left are the top-left of the border-box for the first css box (in content order) for the element. the amount of scrolling that has been done of the viewport area (or any other scrollable element) is taken into account when computing the bounding rectangle. this means that the rectangle's boundary edges (top, right, bottom, left) change their values every time the scrolling ...
Element: mousewheel event - Web APIs
ver part of any standard, and while it was implemented by several browsers, it was never implemented by firefox. important: instead of this obsolete event, use the standard wheel event. bubbles yes cancelable yes interface mousewheelevent event handler property onmousewheel the detail property the value of the detail property is always zero, except in opera, which uses detail similarly to the firefox-only dommousescroll event's detail value, which indicates the scroll distance in terms of lines, with negative values indicating the scrolling movement is either toward the bottom or toward the right, and positive values indicating scrolling to the top or left. note: on macos, the scroll distance (and therefore the value of detail) is...
FileList - Web APIs
Web › API › FileList
t.getelementbyid('fileitem').files[0]; method overview file item(index); properties attribute type description length integer a read-only value indicating the number of files in the list. methods item() returns a file object representing the file at the specified index in the file list. file item( index ); parameters index the zero-based index of the file to retrieve from the list. return value the file representing the requested file. example this example iterates over all the files selected by the user using an input element: // fileinput is an html input element: <input type="file" id="myfileinput" multiple> var fileinput = document.getelementbyid("myfileinput"); // files is a filelist object (similar to nodelist)...
FileSystemFlags - Web APIs
the filesystemflags dictionary defines a set of values which are used when specifying option flags when calling certain methods in the file and directory entries api. methods which accept an options parameter of this type may specify zero or more of these flags as fields in an object, like this: datadirectoryentry.getdirectory("workspace", { create: true }, function(entry) { }); here, we see that the create property is provided, with a value of true, indicating that the directory should be created if it's not already there. note that these option flags currently don't have any useful meaning when used in the scope of web content, where security precautions prevent the creation of new files or the replacement of existing ones. properties create optional if this property is true, an...
Gamepad.buttons - Web APIs
Web › API › Gamepad › buttons
each gamepadbutton object has two properties: pressed and value: the pressed property is a boolean indicating whether the button is currently pressed (true) or unpressed (false). the value property is a floating point value used to enable representing analog buttons, such as the triggers on many modern gamepads. ...
GeolocationCoordinates.heading - Web APIs
if geolocationcoordinates.speed is 0, heading is nan. if the device is not able to provide heading information, this value is null. ...
GeolocationCoordinates.longitude - Web APIs
object type returned by geolocation api functions that obtain and return a geographical position. syntax let longitude = geolocationcoordinatesinstance.longitude value the value in longitude is the geographical longitude of the location on earth described by the coordinates object, in decimal degrees. the value is defined by the world geodetic system 1984 specification (wgs 84). note: the zero meridian (also known as the prime meridian or the reference meridian) is not precisely the same as the greenwhich meridian that most people think of. it is, instead, the iers reference meridian, which is located 5.3 arcseconds (102 meters / 335 feet) east of the greenwich meridian. this is the same standard used by the global positioning system (gps). examples in this simple example, we fetch ...
GlobalEventHandlers.onanimationiteration - Web APIs
a look. var box = document.getelementbyid("box"); var iterationcounter = 0; box.onanimationiteration = function(event) { box.style.animationplaystate = "paused"; document.getelementbyid("play").innerhtml = "start iteration #" + (iterationcounter+1); }; this sets up two global variables: box, which references the "box" element that we're animating, and iterationcounter, which is initially zero, which indicates how many iterations of the animation have occurred. the onanimationiteration event handler is then set up. it simply sets the box's animation-play-state to "paused", then updates the text displayed in the button to indicate that clicking the button will start playing the next iteration of theanimation. finally, we set up a handler for a click on the button that runs the animati...
GlobalEventHandlers.ontransitioncancel - Web APIs
nction receives as input a single parameter: a transitionevent object describing the event which occurred; the event's transitionevent.elapsedtime property's value should be the same as the value of transition-duration. note: elapsedtime does not include time prior to the transition effect beginning; that means that the value of transition-delay doesn't affect the value of elapsedtime, which is zero until the delay period ends and the animation begins. example in this example, we use the transitionrun and transitionend events to detect when the transition begins and ends, to cause a text update to occur during the transition. this could also be used to trigger animations or other effects, to allow chaining of reactions. in addition, we also use a click event to make the box dissappear (d...
GlobalEventHandlers.ontransitionend - Web APIs
the function receives as input a single parameter: a transitionevent object describing the event which occurred; the event's transitionevent.elapsedtime property's value should be the same as the value of transition-duration. elapsedtime does not include time prior to the transition effect beginning; that means that the value of transition-delay doesn't affect the value of elapsedtime, which is zero until the delay period ends and the animation begins. example in this example, we use the transitionrun and transitionend events to detect when the transition begins and ends, to cause a text update to occur during the transition. this could also be used to trigger animations or other effects, to allow chaining of reactions. html this simply creates a <div> which we'll style with css below t...
HTMLCollection.item - Web APIs
s in the collection to change, so the index value will not necessarily remain constant for a given node. syntax var element = htmlcollection.item(index) parameters index the position of the node to be returned. elements appear in an htmlcollection in the same order in which they appear in the document's source. return value the node at the specified index, or null if index is less than zero or greater than or equal to the length property. usage notes the item() method returns a numbered element from an htmlcollection. in javascript, it is easier to treat the htmlcollection as an array and to index it using array notation. see the example below. example var c = document.images; // this is an htmlcollection var img0 = c.item(0); // you can use the item() method this way var i...
HTMLCollection - Web APIs
sons (before the modern dom, collections implementing this interface could only have html elements as their items). an htmlcollection in the html dom is live; it is automatically updated when the underlying document is changed. properties htmlcollection.length read only returns the number of items in the collection. methods htmlcollection.item() returns the specific node at the given zero-based index into the list. returns null if the index is out of range. an alternative to accessing collection[i] (which instead returns undefined when i is out-of-bounds). this is mostly useful for non-javascript dom implementations. htmlcollection.nameditem() returns the specific node whose id or, as a fallback, name matches the string specified by name. matching by name is only done as a las...
HTMLImageElement.srcset - Web APIs
e candidate string should be used when the image is being rendered with a particular width in pixels, provide a width descriptor comprised the number giving that width in pixels followed by the lower case letter "w". for example, to provide an image resource to be used when the renderer needs a 450 pixel wide image, use the width descriptor string 450w. the specified width must be a positive, non-zero, integer, and must match the intrinsic width of the referenced image. alternatively, you can use a pixel density descriptor, which specifies the condition in which the corresponding image resource should be used as the display's pixel density. this is written by stating the pixel density as a positive, non-zero floating-point value followed by the lower-case letter "x". as an example, to state t...
HTMLProgressElement - Web APIs
"consolas,monaco,andale mono,monospace" fill="#4d4e53" text-anchor="middle" alignment-baseline="middle">htmlprogresselement</text></a></svg></div> a:hover text { fill: #0095dd; pointer-events: all;} properties inherits properties from its parent, htmlelement. htmlprogresselement.max is a double value reflecting the content attribute of the same name, limited to numbers greater than zero. its default value is 1.0. htmlprogresselement.positionread only returns a double value returning the result of dividing the current value (value) by the maximum value (max); if the progress bar is an indeterminate progress bar, it returns -1. htmlprogresselement.value is a double value that reflects the current value; if the progress bar is an indeterminate progress bar, it returns 0. html...
HTMLVideoElement.videoHeight - Web APIs
r the resize event that resizes the <video> element to match the intrinsic size of its contents. let v = document.getelementbyid("myvideo"); v.addeventlistener("resize", ev => { let w = v.videowidth; let h = v.videoheight; if (w && h) { v.style.width = w; v.style.height = h; } }, false); note that this only applies the change if both the videowidth and the videoheight are non-zero. this avoids applying invalid changes when there's no true information available yet for dimensions. specifications specification status comment html living standardthe definition of 'htmlvideoelement.videoheight' in that specification. living standard html5the definition of 'htmlvideoelement.videoheight' in that specification. recommendation initia...
HTMLVideoElement.videoWidth - Web APIs
r the resize event that resizes the <video> element to match the intrinsic size of its contents. let v = document.getelementbyid("myvideo"); v.addeventlistener("resize", ev => { let w = v.videowidth; let h = v.videoheight; if (w && h) { v.style.width = w; v.style.height = h; } }, false); note that this only applies the change if both the videowidth and the videoheight are non-zero. this avoids applying invalid changes when there's no true information available yet for dimensions. specifications specification status comment html living standardthe definition of 'htmlvideoelement.videowidth' in that specification. living standard html5the definition of 'htmlvideoelement.videowidth' in that specification. recommendation initial...
The HTML DOM API - Web APIs
"send" button's disabled property is set to true, which disables the "send" button so it can't be clicked. in addition, the user name input field is made the active focus by calling the focus() method it inherits from htmlelement. then addeventlistener() is called to add a handler for the input event to the user name input. this code looks at the length of the current value of the input; if it's zero, then the "send" button is disabled if it's not already disabled. otherwise, the code ensures that the button is enabled. with this in place, the "send" button is always enabled whenever the user name input field has a value, and disabled when it's empty. html the html for the form looks like this: <p>please provide the information below. items marked with "*" are required.</p> <form action="...
Headers - Web APIs
Web › API › Headers
the headers interface of the fetch api allows you to perform various actions on http request and response headers. these actions include retrieving, setting, adding to, and removing headers from the list of the request's headers. a headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs. you can add to this using methods like append() (see examples.) in all methods of this interface, header names are matched by case-insensitive byte sequence. for security reasons, some headers can only be controlled by the user agent. these headers include the forbidden header names and forbidden response header names. a headers object also has an associated guard, which takes a value of immutable, request, request-no-cors, response, or non...
IDBCursor.advance() - Web APIs
Web › API › IDBCursor › advance
is available in web workers. syntax cursor.advance(count); parameters count the number of times to move the cursor forward. exceptions this method may raise a domexception of one of the following types: exception description transactioninactiveerror this idbcursor's transaction is inactive. typeerror the value passed into the count parameter was zero or a negative number. invalidstateerror the cursor is currently being iterated or has iterated past its end. example in this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through the records in the object store. here we use cursor.advance(2) to jump 2 places forward each time, meaning that only every other result will be ...
IDBFactory.open() - Web APIs
Web › API › IDBFactory › open
he different available storage types, and how firefox handles client-side data storage, at browser storage limits and eviction criteria. return value a idbopendbrequest object on which subsequent events related to this request are fired. exceptions this method may raise a domexception of the following types: exception description typeerror the value of version is zero or a negative number or not a number. example example of calling open with the current specification's version parameter: var request = window.indexeddb.open("todolist", 4); in the following code snippet, we make a request to open a database, and include handlers for the success and error cases. for a full working example, see our to-do notifications app (view example live.) var note =...
IIRFilterNode - Web APIs
ed iir filters can be created using biquadfilternode. however, if you need to create an odd-ordered iir filter, you'll need to use iirfilternode. you may also find this interface useful if you don't need automation, or for other reasons. once the node has been created, you can't change its coefficients. iirfilternodes have a tail-time reference; they continue to output non-silent audio with zero input. as an iir filter, the non-zero input continues forever, but this can be limited after some finite time in practice, when the output has approached zero closely enough. the actual time that takes depends on the filter coefficients provided. constructor iirfilternode() creates a new instance of an iirfilternode object. properties this interface has no properties of its own; however, ...
IdleDeadline.timeRemaining() - Web APIs
er agent's event loop. syntax timeremaining = idledeadline.timeremaining(); return value a domhighrestimestamp value (which is a floating-point number) representing the number of milliseconds the user agent estimates are left in the current idle period. the value is ideally accurate to within about 5 microseconds. if the idledeadline object's didtimeout property is true, this method returns zero. example see our complete example in the article cooperative scheduling of background tasks api. specifications specification status comment cooperative scheduling of background tasks proposed recommendation ...
Checking when a deadline is due - Web APIs
em notification createnotification(cursor.value.tasktitle); } with the current time and date segments that we want to check against the indexeddb stored values all assembled, it is time to perform the checks. we want all the values to match before we show the user some kind of notification to tell them their deadline is up. the + operator in this case converts numbers with leading zeros into their non leading zero equivalents, e.g. 09 -> 9. this is needed because javascript date number values never have leading zeros, but our data might. the notified == "no" check is designed to make sure you will only get one notification per to-do item. when a notification is fired for each item object, its notification property is set to "yes" so this check will not pass on the next iterati...
IntersectionObserverEntry.intersectionRatio - Web APIs
ionobserverentry.intersectionratio; value a number between 0.0 and 1.0 which indicates how much of the target element is actually visible within the root's intersection rectangle. more precisely, this value is the ratio of the area of the intersection rectangle (intersectionrect) to the area of the target's bounds rectangle (boundingclientrect). if the area of the target's bounds rectangle is zero, the returned value is 1 if isintersecting is true or 0 if not. example in this simple example, an intersection callback sets each target element's opacity to the intersection ratio of that element with the root. function intersectioncallback(entries) { entries.foreach(function(entry) { entry.target.style.opacity = entry.intersectionratio; }); } to see a more concrete example, take a ...
Timing element visibility with the Intersection Observer API - Web APIs
gh—in fact, javascript generally does it automatically, although we'll have one instance where we have to do it ourselves. we start by fetching the time at which the ad's previous visibility status check time (adbox.dataset.lastviewstarted) into a local variable named laststarted. we also get the current time-since-creation value using performance.now() into currenttime. if laststarted is non-zero—meaning the timer is currently running, we compute the difference between the current time and the start time to determine the number of milliseconds the timer has been visible since the last time it became visible. this is added to the current value of the ad's totalviewtime to bring the total up to date. note the use of parsefloat() here; because these values are strings, javascript tries to ...
LockedFile.location - Web APIs
non-standard this feature is non-standard and is not on a standards track. do not use it on production sites facing the web: it will not work for every user. there may also be large incompatibilities between implementations and the behavior may change in the future. summary the location property is a zero-based index representing the position of the read/write pointer within the file. its value indicates at which bytes within the file any write or read operation will start. this value is changed automatically after every read and write operation. the special value null means end-of-file. this property can be changed at will. syntax var location = instanceoflockedfile.location value a number. specifications specification status comment ...
MediaPositionState.position - Web APIs
e an integrated common user interface showing the currently playing media as well as standard pause, play, forward, reverse, and other controls. syntax let positionstate = { position: timeinseconds }; let duration = positionstate.duration; value a floating-point value indicating the current playback position within the media currently being performed, in seconds. this value should always be zero or more. example in this example, a player for a non-standard media file format, written in javascript, uses setinterval() to establish a callback which fires once per second to refresh the position information by calling setpositionstate(). if the media is still playing when the interval is fired, setpositionstate() is called with an object that specifies the duration, playback rate, and posit...
MediaSession.setPositionState() - Web APIs
the document's ongoing media. if the object is empty, the existing playback state information is cleared. return value undefined. exceptions typeerror this error can occur in an array of circumstances: the specified mediapositionstate object's duration is missing, negative, or null. position is missing or null, or is either negative or greater than duration. the playbackrate is zero. example in this example, a player for a non-standard media file format, written in javascript, uses setinterval() to establish a callback which fires once per second to refresh the position information by calling setpositionstate(). if the media is still playing when the interval is fired, setpositionstate() is called with an object that specifies the duration, playback rate, and position...
Capabilities, constraints, and settings - Web APIs
").disabled = !supported["framerate"]; in this example, the supported constraints are fetched, and a control that lets the user configure the frame rate is disabled if the framerate constraint isn't supported. how constraints are defined a single constraint is an object whose name matches the constrainable property whose desired value or range of values is being specified. this object contains zero or more individual constraints, as well as an optional sub-object named advanced, which contains another set of zero or more constraints which the user agent must satisfy if at all possible. the user agent attempts to satisfy constraints in the order specified in the constraint set. the most important thing to understand is that most constraints aren't requirements; instead, they're requests. t...
Media Capture and Streams API (Media Stream) - Web APIs
he streams and their constituent tracks, the constraints associated with data formats, the success and error callbacks when using the data asynchronously, and the events that are fired during the process. concepts and usage the api is based on the manipulation of a mediastream object representing a flux of audio- or video-related data. see an example in get the video. a mediastream consists of zero or more mediastreamtrack objects, representing various audio or video tracks. each mediastreamtrack may have one or more channels. the channel represents the smallest unit of a media stream, such as an audio signal associated with a given speaker, like left or right in a stereo audio track. mediastream objects have a single input and a single output. a mediastream object generated by getusermedi...
MerchantValidationEvent() - Web APIs
event object. you should not have to create these events yourself; instead, just handle the merchantvalidation event. syntax merchantvalidationevent = new merchantvalidationevent(type, options); parameters type a domstring which must be merchantvalidation, the only type of event which uses the merchantvalidationevent interface. options optional an optional dictionary which may contain zero or more of the following properties: methodname optional a domstring containing the payment method identifier for the payment handler being used. this is an empty string by default. validationurl optional the url from which to retrieve payment handler specific verification information used to validate the merchant. this is an empty string by default. return value a newly-created...
MouseEvent.button - Web APIs
Web › API › MouseEvent › button
ressed on the mouse to trigger the event. this property only guarantees to indicate which buttons are pressed during events caused by pressing or releasing one or multiple buttons. as such, it is not reliable for events such as mouseenter, mouseleave, mouseover, mouseout or mousemove. users may change the configuration of buttons on their pointing device so that if an event's button property is zero, it may not have been caused by the button that is physically left–most on the pointing device; however, it should behave as if the left button was clicked in the standard button layout. note: do not confuse this property with the mouseevent.buttons property, which indicates which buttons are pressed for all mouse events types. syntax var buttonpressed = instanceofmouseevent.button retur...
Navigator.vibrate() - Web APIs
Web › API › Navigator › vibrate
pattern provides a pattern of vibration and pause intervals. each value indicates a number of milliseconds to vibrate or pause, in alternation. you may provide either a single value (to vibrate once for that many milliseconds) or an array of values to alternately vibrate, pause, then vibrate again. see vibration api for details. passing a value of 0, an empty array, or an array containing all zeros will cancel any currently ongoing vibration pattern. examples window.navigator.vibrate(200); // vibrate for 200ms window.navigator.vibrate([100,30,100,30,100,30,200,30,200,30,200,30,100,30,100,30,100]); // vibrate 'sos' in morse. specifications specification status comment vibration api recommendation linked to spec is the latest editor's draft; w3c version...
NodeList.item() - Web APIs
Web › API › NodeList › item
ndex. this method doesn't throw exceptions as long as you provide arguments. a value of null is returned if the index is out of range, and a typeerror is thrown if no argument is provided. syntax nodeitem = nodelist.item(index) nodelist is a nodelist. this is usually obtained from another dom property or method, such as childnodes. index is the index of the node to be fetched. the index is zero-based. nodeitem is the indexth node in the nodelist returned by the item method. alternate syntax javascript also offers an array-like bracketed syntax for obtaining an item from a nodelist by index: nodeitem = nodelist[index] example var tables = document.getelementsbytagname("table"); var firsttable = tables.item(1); // or simply tables[1] - returns the second table in the dom specifi...
PaymentMethodChangeEvent - Web APIs
ect providing details about a paymentmethodchange event. syntax paymentmethodchangeevent = new paymentmethodchangeevent(type, options); parameters type a domstring which must contain the string paymentmethodchange, the name of the only type of event which uses the paymentmethodchangeevent interface. options optional an optional paymentmethodchangeeventinit dictionary which may contain zero or more of the following properties: methodname optional a domstring containing the payment method identifier for the payment handler being used. this is an empty string by default. methoddetails optional an object providing payment method-specific information describing the changes made to the payment, or null if there is no additional information available or required. this is null b...
PerformanceResourceTiming.redirectEnd - Web APIs
g the last byte of the response of the last redirect. when fetching a resource, if there are multiple http redirects, and any of the redirects have an origin that is different from the current document, and the timing allow check algorithm passes for each redirected resource, this property returns the time immediately after receiving the last byte of the response of the last redirect; otherwise, zero is returned. note: this feature is available in web workers. syntax resource.redirectend; return value a timestamp immediately after receiving the last byte of the response of the last redirect. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just g...
PerformanceResourceTiming.redirectStart - Web APIs
eturns a timestamp representing the start time of the fetch which that initiates the redirect. if there are http redirects when fetching the resource and if any of the redirects are not from the same origin as the current document, but the timing allow check algorithm passes for each redirected resource, this property returns the starting time of the fetch that initiates the redirect; otherwise, zero is returned. note: this feature is available in web workers. syntax resource.redirectstart; return value a timestamp representing the start time of the fetch which initiates the redirect. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just get the ...
PerformanceResourceTiming.secureConnectionStart - Web APIs
the secureconnectionstart read-only property returns a timestamp immediately before the browser starts the handshake process to secure the current connection. if a secure connection is not used, the property returns zero. note: this feature is available in web workers. syntax resource.secureconnectionstart; return value if the resource is fetched over a secure connection, a domhighrestimestamp immediately before the browser starts the handshake process to secure the current connection. if a secure connection is not used, this property returns zero. example in the following example, the value of the *start and *end properties of all "resource" type events are logged. function print_performanceentries() { // use getentriesbytype() to just get the "resource" events var p = performan...
PerformanceResourceTiming.transferSize - Web APIs
the transfersize read-only property represents the size (in octets) of the fetched resource. the size includes the response header fields plus the response payload body (as defined by rfc7230). note: this feature is available in web workers. if the resource is fetched from a local cache, or if it is a cross-origin resource, this property returns zero. syntax resource.transfersize; return value a number representing the size (in octets) of the fetched resource. the size includes the response header fields plus the response payload body (rfc7230). example the following example, the value of size properties of all "resource" type events are logged. function log_sizes(perfentry){ // check for support of the performanceentry.*size properties and print their values // if supported. ...
Pointer Lock API - Web APIs
e cursor does not exist and the cursor cannot move off the window or be clamped by a screen edge. unlocked state the parameters movementx and movementy are valid regardless of the mouse lock state, and are available even when unlocked for convenience. when the mouse is unlocked, the system cursor can exit and re-enter the browser window. if that happens, movementx and movementy could be set to zero. simple example walkthrough we've written a simple pointer lock demo to show you how to use it to set up a simple control system (see source code). the demo looks like this: this demo uses javascript to draw a ball on top of an <canvas> element. when you click the canvas, pointer lock is then used to remove the mouse pointer and allow you to move the ball directly using the mouse. let's see ...
Pointer events - Web APIs
use events (client coordinates, target element, button states, etc.) in addition to new properties for other forms of input: pressure, contact geometry, tilt, etc. in fact, the pointerevent interface inherits all of the mouseevent properties, thus facilitating the migration of content from mouse events to pointer events. terminology active buttons state the condition when a pointer has a non-zero value for the buttons property. for example, in the case of a pen, when the pen has physical contact with the digitizer, or at least one button is depressed while hovering. active pointer any pointer input device that can produce events. a pointer is considered active if it can still produce further events. for example, a pen that is a down state is considered active because it can produce addi...
RTCConfiguration.iceServers - Web APIs
the rtcconfiguration dictionary's iceservers property is an array of rtciceserver objects, each of which describes a single stun or turn server to use for negotiation purposes. syntax let rtcconfiguration = { iceservers: [ iceserver1... ] }; let rtcconfiguration.iceservers = [ iceserver1... ]; value an array of zero or more rtciceserver objects, each of which describes one stun or turn server for the ice agent to use during the connection's negotiation. each object must at least have an urls property, which is an array of one or more strings, each providing one server's url. if the array is empty, or if the iceservers option isn't specified, the ice agent will negotiate without the use of any servers, which will limit the connection to local peers. description how the lis...
RTCIceCandidate.sdpMLineIndex - Web APIs
this value is specified when creating the rtcicecandidate by setting the corresponding sdpmlineindex value in the rtcicecandidateinit object when creating a new candidate with new rtcicecandidate(). if you instead call rtcicecandidate() with a string parameter containing the candidate m-line text, the value of sdpmlineindex is extracted from the m-line. ...
RTCIceCandidate - Web APIs
date from which this candidate is derived. for host candidates, the relatedport property is null. sdpmid read only a domstring specifying the candidate's media stream identification tag which uniquely identifies the media stream within the component with which the candidate is associated, or null if no such association exists. sdpmlineindex read only if not null, sdpmlineindex indicates the zero-based index number of the media description (as defined in rfc 4566) in the sdp with which the candidate is associated. tcptype read only if protocol is "tcp", tcptype represents the type of tcp candidate. otherwise, tcptype is null. type read only a domstring indicating the type of candidate as one of the strings from the rtcicecandidatetype enumerated type. usernamefragment read only a...
RTCIceCandidateInit - Web APIs
e candidate-attribute. if the candidate is an indicator that there are no further candidates (rather than representing a new candidate), this is the empty string (""). the default is the empty string. sdpmid optional the identification tag of the media stream with which the candidate is associated, or null if there is no associated media stream. the default is null. sdpmlineindex optional the zero-based index of the m-line within the sdp of the media description with which the candidate is associated, or null if no such associated exists. the default is null. usernamefragment optional a domstring containing a string which uniquely identifies the remote peer. this string is generated by webrtc at the beginning of the session, and at least 24 bits worth of the string contain random data. t...
RTCInboundRtpStreamStats.bytesReceived - Web APIs
c). syntax var bytesreceived = rtcinboundrtpstreamstats.bytesreceived; value an unsigned integer value indicating the total number of bytes received so far on this rtp stream, not including header and padding bytes. this value can be used to calculate an approximation of the average media data rate: avgdatarate = rtcinboundrtpstreamstats.bytesreceived / elapsedtime; this value gets reset to zero if the sender's ssrc identifier changes for any reason. specifications specification status comment identifiers for webrtc's statistics apithe definition of 'rtcinboundrtpstreamstats.bytesreceived' in that specification. candidate recommendation initial definition. ...
RTCPeerConnection.getConfiguration() - Web APIs
exponent: new uint8array([1, 0, 1]) }).then(function(cert) { configuration.certificates = [cert]; mypeerconnection.setconfiguration(configuration); }); } this example fetches the current configuration of the rtcpeerconnection, then looks to see if it has any certificates set by examining whether or not (a) the configuration has a value for certificates, and (b) whether its length is zero. if it's determined that there are no certificates in place, rtcpeerconnection.generatecertificate() is called to create a new certificate; we provide a fulfillment handler which adds a new array containing the one newly-created certificate to the current configuration and passes it to setconfiguration() to add the certificate to the connection. specifications specification status ...
RTCPeerConnection.onremovestream - Web APIs
the removestream event has been removed from the webrtc specification in favor of the existing removetrack event on the remote mediastream and the corresponding mediastream.onremovetrack event handler property of the remote mediastream. the rtcpeerconnection api is now track-based, so having zero tracks in the remote stream is equivalent to the remote stream being removed and the old removestream event. the rtcpeerconnection.onremovestream event handler is a property containing the code to execute when the removestream event, of type mediastreamevent, is received by this rtcpeerconnection. such an event is sent when a mediastream is removed from this connection. syntax peerconnection.onremovestream = function; values function is the name of a user-defined function, without the ()...
RTCPeerConnection: removestream event - Web APIs
...
RTCRtpParameters - Web APIs
dparameters and rtcrtpreceiveparameters dictionaries. to obtain the parameters of a sender or receiver, call its getparameters() method: getparameters() getparameters() properties codecs an array of rtcrtpcodecparameters objects describing the set of codecs from which the sender or receiver will choose. this parameter cannot be changed once initially set. headerextensions an array of zero or more rtp header extensions, each identifying an extension supported by the sender or receiver. header extensions are described in rfc 3550: 5.3.1. this parameter cannot be changed once initially set. rtcp an rtcrtcpparameters object providing the configuration parameters used for rtcp on the sender or receiver. this parameter cannot be changed once initially set. examples this example obt...
Range.comparePoint() - Web APIs
is a node of type text, comment, or cdatasection, then offset is the number of characters from the start of reference node. for other node types, offset is the number of child nodes between the start of the reference node. syntax returnvalue = range.comparepoint(referencenode, offset) parameters referencenode the node to compare with the range. offset an integer greater than or equal to zero representing the offset inside the referencenode. example range = document.createrange(); range.selectnode(document.getelementsbytagname('div').item(0)); returnvalue = range.comparepoint(document.getelementsbytagname('p').item(0), 1); specification specification status comment domthe definition of 'range.comparepoint()' in that specification. living standard in...
Range.setStart() - Web APIs
Web › API › Range › setStart
he number of child nodes between the start of the startnode. setting the start point below (lower in the document) the end point will result in a collapsed range with the start and end points both set to the specified start position. syntax range.setstart(startnode, startoffset); parameters startnode the node where the range should start. startoffset an integer greater than or equal to zero representing the offset for the start of the range from the start of startnode. examples highlight part of an element this example uses the range.setstart() and range.setend() methods to add part of an address to a range. the selected range is then highlighted using range.surroundcontents(). the address contains nine nodes: five text nodes, and four <br> elements. html <p id="address">wya...
Resource Timing API - Web APIs
nsestart - the timestamp after the browser receives the first byte of the response from the server; and responseend - the timestamp after the browser receives the last byte of the resource. if the resource is loaded via a secure connection a secureconnectionstart timestamp will be available between the connection start and end events. when cors is in effect, many of these values are returned as zero unless the server's access policy permits these values to be shared. this requires the server providing the resource to send the timing-allow-origin http response header with a value specifying the origin or origins which are allowed to get the restricted timestamp values. the properties which are returned as 0 by default when loading a resource from a domain other than the one of the web page i...
SVGAnimationElement - Web APIs
ionelement.getstarttime() returns a float representing the begin time, in seconds, for this animation element's current interval, if it exists, regardless of whether the interval has begun yet. if there is no current interval, then a domexception with code invalid_state_err is thrown. svganimationelement.getcurrenttime() returns a float representing the current time in seconds relative to time zero for the given time container. svganimationelement.getsimpleduration() returns a float representing the number of seconds for the simple duration for this animation. if the simple duration is undefined (e.g., the end time is indefinite), then a domexception with code not_supported_err is raised. svganimationelement.beginelement() creates a begin instance time for the current time. the new in...
SVGMarkerElement - Web APIs
atedenumeration corresponds to attribute orient on the given marker element. one of the marker orientation types defined on this interface. orientangle svganimatedangle corresponds to attribute orient on the given marker element. if markerunits is svg_marker_orient_angle, the angle value for attribute orient; otherwise, it will be set to zero. methods this also inherits methods from its parent, svgelement, and implements properties from svgstylable. setorienttoangle(in svgangle angle) void sets the value of attribute orient to the given angle. exceptions: a domexceptio...
SVGRect - Web APIs
Web › API › SVGRect
of this coordinate depends on each element. if the attribute is not specified, the effect is as if a value of 0 were specified. svgrect.y the exact effect of this coordinate depends on each element.if the attribute is not specified, the effect is as if a value of 0 were specified. svgrect.width this represents the width of the rectangle.a value that is negative results to an error. a value of zero disables rendering of the element svgrect.height this represents the height of the rectangle.a value that is negative results to an error.a value of zero disables rendering of the element. methods this interface also inherits properties from its parent, domrectreadonly. specifications specification status comment geometry interfaces module level 1the definition of '...
Selection.anchorOffset - Web APIs
if the selection begins with the first character in the selection.anchornode, 0 is returned. ...
Selection.focusOffset - Web APIs
if the selection ends with the first character in the selection.focusnode, 0 is returned. ...
Selection.getRangeAt() - Web APIs
a negative number or a number greater than or equal to selection.rangecount will result in an error. return value the specified range object. ...
Selection.isCollapsed - Web APIs
the selection.iscollapsed read-only property returns a boolean which indicates whether or not there is currently any text selected. no text is selected when the selection's start and end points are at the same position in the content. keep in mind that a collapsed selection may still have one (or more, in gecko) ranges, so selection.rangecount may not be zero. in that scenario, calling a selection object's getrangeat() method may return a range object which is collapsed. syntax bool = sel.iscollapsed specifications specification status comment selection apithe definition of 'selection.iscollapsed' in that specification. working draft current ...
StaticRange.collapsed - Web APIs
the collapsed read-only property of the staticrange interface returns true if the range's start position and end position are the same. syntax var iscollpased = staticrange.collapsed value a boolean value which is true if the range is collapsed. a collapsed range is one in which the start and end positions are the same, resulting in a zero-character-long range.. specifications specification status comment domthe definition of 'collapsed' in that specification. living standard static rangethe definition of 'collapsed' in that specification. editor's draft initial definition. ...
Storage.key() - Web APIs
Web › API › Storage › key
return value a domstring containing the name of the key. ...
Streams API concepts - Web APIs
culation performed is high water mark - total size of chunks in queue = desired size the desired size is the size of chunks the stream can still accept to keep the stream flowing but below the high water mark in size. after the calculation is performed, chunk generation will be slowed down/sped up as appropriate to keep the stream flowing as fast as possible while keeping the desired size above zero. if the value falls to zero (or below in the case of writable streams), it means that chunks are being generated faster than the stream can cope with, which results in problems. note: what happens in the case of zero or negative desired size hasn’t really been defined in the spec so far. patience is a virtue. as an example, let's take a chunk size of 1, and a high water mark of 3. this mean...
ValidityState.stepMismatch - Web APIs
ute. if the field is numeric in nature, including the date, month, week, time, datetime-local, number and range types and the step value is not any, if the value don't doesn't conform to the constraints set by the step and min values, then stepmismatch will be true. if the remainder of the form control's value less the min value, divided by the step value (which defaults to 1 if ommitted) is not zero, there is a mismatch. given the following: <input type="number" min="20" max="40" step="2"/> if (value - min) / 2 != 0, stepmismatch will be true. if true, the element matches the :invalid and :out-of-range css pseudo-classes. specifications specification status comment html living standardthe definition of 'validitystate.stepmismatch' in that specification. livi...
Vibration API - Web APIs
ms. you may specify as many vibration/pause pairs as you like, and you may provide either an even or odd number of entries; it's worth noting that you don't have to provide a pause as your last entry since the vibration automatically stops at the end of each vibration period. canceling existing vibrations calling navigator.vibrate() with a value of 0, an empty array, or an array containing all zeros will cancel any currently ongoing vibration pattern. continued vibrations some basic setinterval and clearinterval action will allow you to create persistent vibration: var vibrateinterval; // starts vibration at passed in level function startvibrate(duration) { navigator.vibrate(duration); } // stops vibration function stopvibrate() { // clear interval and stop persistent vibrating...
WebGL2RenderingContext.getBufferSubData() - Web APIs
er or sharedarraybuffer to which to write the buffer data. srcoffset optional a gluint specifying the element index offset where to start reading the buffer. length optional a gluint defaulting to 0. return value none. exceptions an invalid_value error is generated if: offset + returneddata.bytelength would extend beyond the end of the buffer returneddata is null offset is less than zero. an invalid_operation error is generated if: zero is bound to target target is transform_feedback_buffer, and any transform feedback object is currently active. examples var buffer = gl.createbuffer(); gl.bindbuffer(gl.array_buffer, buffer); gl.bufferdata(gl.array_buffer, new float32array(vertices), gl.static_draw); var arrbuffer = new arraybuffer(vertices.length * float32array.bytes_pe...
WebGLRenderingContext.checkFramebufferStatus() - Web APIs
h of the attachment are not the same. gl.framebuffer_unsupported: the format of the attachment is not supported or if depth and stencil attachments are not the same renderbuffer. when using a webgl 2 context, the following values can be returned additionally: gl.framebuffer_incomplete_multisample: the values of gl.renderbuffer_samples are different among attached renderbuffers, or are non-zero if the attached images are a mix of renderbuffers and textures. when using the ovr_multiview2 extension, the following value can be returned additionally: ext.framebuffer_incomplete_view_targets_ovr: if baseviewindex is not the same for all framebuffer attachment points where the value of framebuffer_attachment_object_type is not none, the framebuffer is considered incomplete. ...
WebGLRenderingContext.vertexAttribPointer() - Web APIs
th a length of 20 bytes per vertex: position: we need to store the x, y and z coordinates. for highest precision, we use 32-bit floats; in total this uses 12 bytes. normal vector: we need to store the x, y and z components of the normal vector, but since precision is not that important, we use 8-bit signed integers. for better performance, we align the data to 32 bits by also storing a fourth zero-valued component, bringing the total size to 4 bytes. also, we tell webgl to normalize the values because our normals are always in range [-1, 1]. texture coordinate: we need to store the u and v coordinates; for this 16-bit unsigned integers offer enough precision, the total size is 4 bytes. we also tell webgl to normalize the values to [0, 1]. for example, the following vertex: { "positio...
WebGL constants - Web APIs
assed to drawelements or drawarrays to draw a connected group of triangles. each vertex connects to the previous and the first vertex in the fan. blending modes constants passed to webglrenderingcontext.blendfunc() or webglrenderingcontext.blendfuncseparate() to specify the blending mode (for both, rbg and alpha, or separately). constant name value description zero 0 passed to blendfunc or blendfuncseparate to turn off a component. one 1 passed to blendfunc or blendfuncseparate to turn on a component. src_color 0x0300 passed to blendfunc or blendfuncseparate to multiply a component by the source elements color. one_minus_src_color 0x0301 passed to blendfunc or blendfuncseparate to multiply a component by on...
Lighting in WebGL - Web APIs
hing we do is transform the normal based on the current orientation of the cube, by multiplying the vertex's normal by the normal matrix. we can then compute the amount of directional lighting that needs to be applied to the vertex by calculating the dot product of the transformed normal and the directional vector (that is, the direction from which the light is coming). if this value is less than zero, then we pin the value to zero, since you can't have less than zero light. once the amount of directional lighting is computed, we can generate the lighting value by taking the ambient light and adding in the product of the directional light's color and the amount of directional lighting to provide. as a result, we now have an rgb value that will be used by the fragment shader to adjust the colo...
Signaling and video calling - Web APIs
(event) { var stream = document.getelementbyid("received_video").srcobject; var tracklist = stream.gettracks(); if (tracklist.length == 0) { closevideocall(); } } this code fetches the incoming video mediastream from the "received_video" <video> element's srcobject attribute, then calls the stream's gettracks() method to get an array of the stream's tracks. if the array's length is zero, meaning there are no tracks left in the stream, we end the call by calling closevideocall(). this cleanly restores our app to a state in which it's ready to start or receive another call. see ending the call to learn how closevideocall() works. ending the call there are many reasons why calls may end. a call might have completed, with one or both sides having hung up. perhaps a network failure...
Taking still photos with WebRTC - Web APIs
th; canvas.height = height; context.drawimage(video, 0, 0, width, height); var data = canvas.todataurl('image/png'); photo.setattribute('src', data); } else { clearphoto(); } } as is the case any time we need to work with the contents of a canvas, we start by getting the 2d drawing context for the hidden canvas. then, if the width and height are both non-zero (meaning that there's at least potentially valid image data), we set the width and height of the canvas to match that of the captured frame, then call drawimage() to draw the current frame of the video into the context, filling the entire canvas with the frame image. note: this takes advantage of the fact that the htmlvideoelement interface looks like an htmlimageelement to any api that accepts...
Movement, orientation, and motion: A WebXR example - Web APIs
otherwise, we create from the orientation changes in mousepitch and mouseyaw a quaternion specifying the inverse of that orientation, so that applying the inverseorientation to the cube will correctly appear to reflect the viewer's movement. then it's time to create a new xrrigidtransform object representing the transform that will be used to create...
Advanced techniques: Creating and sequencing audio - Web APIs
e audio (sec) let's create a function that moves the note forwards by one beat, and loops back to the first when it reaches the 4th (last) one: let currentnote = 0; let nextnotetime = 0.0; // when the next note is due. function nextnote() { const secondsperbeat = 60.0 / tempo; nextnotetime += secondsperbeat; // add beat length to last beat time // advance the beat number, wrap to zero currentnote++; if (currentnote === 4) { currentnote = 0; } } we want to create a reference queue for the notes that are to be played, and the functionality to play them using the functions we've previously created: const notesinqueue = []; function schedulenote(beatnumber, time) { // push the note on the queue, even if we're not playing. notesinqueue.push({ not...
Basic concepts behind Web Audio API - Web APIs
ta. a simple, typical workflow for web audio would look something like this: create the audio context. inside the context, create sources — such as <audio>, oscillator, or stream. create effects nodes, such as reverb, biquad filter, panner, or compressor. choose the final destination for the audio, such as the user's computer speakers. establish connections from the audio sources through zero or more effects, eventually ending at the chosen destination. channel notation the number of audio channels available on a signal is frequently presented in a numeric format, such as 2.0 or 5.1. this is called channel notation. the first number is the number of full frequency range audio channels that the signal includes. the number after the period indicates the number of those channels which...
Using the Web Storage API - Web APIs
ay throw exceptions. if the localstorage object does exist, there is still no guarantee that the localstorage api is actually available, as various browsers offer settings that disable localstorage. so a browser may support localstorage, but not make it available to the scripts on the page. for example, safari browser in private browsing mode gives us an empty localstorage object with a quota of zero, effectively making it unusable. conversely, we might get a legitimate quotaexceedederror, which means that we've used up all available storage space, but storage is actually available. our feature detection should take these scenarios into account. here is a function that detects whether localstorage is both supported and available: function storageavailable(type) { var storage; try { ...
Window.mozPaintCount - Web APIs
although it may still work in some browsers, its use is discouraged since it could be removed at any time. try to avoid using it. returns the number of times the current document has been painted to the screen in this window. syntax var paintcount = window.mozpaintcount; paintcount stores the window.mozpaintcount property value. the window.mozpaintcount value is a long long, and starts at zero when the document is first created, incrementing by one each time the document is painted. specification not part of any w3c technical specification or recommendation. ...
Window.openDialog() - Web APIs
Web › API › Window › openDialog
finds it useful because of its different default assumptions. default behavior the chrome and dialog features are always assumed on, unless explicitly turned off ("chrome=no"). opendialog() treats the absence of the features parameter the same way window.open() does; that is, an empty string sets all features to off) except chrome and dialog, which default to on. if the features parameter is a zero-length string, or contains only one or more of the behavior features (chrome, dependent, dialog and modal) the chrome features are assumed "os' choice." that is, window creation code is not given specific instructions, but is instead allowed to select the chrome that best fits a dialog on that operating system. passing extra parameters to the dialog to pass extra parameters into the dialog, you...
Window: popstate event - Web APIs
d safari always emit a popstate event on page load, but firefox doesn't. note: when writing functions that process popstate event it is important to take into account that properties like window.location will already reflect the state change (if it affected the current url), but document might still not. ...
Window.requestAnimationFrame() - Web APIs
s time to update your animation for the next repaint. the callback function is passed one single argument, a domhighrestimestamp similar to the one returned by performance.now(), indicating the point in time when requestanimationframe() starts to execute callback functions. return value a long integer value, the request id, that uniquely identifies the entry in the callback list. this is a non-zero value, but you may not make any other assumptions about its value. you can pass this value to window.cancelanimationframe() to cancel the refresh callback request. example in this example, an element is animated for 2 seconds (2000 milliseconds). the element moves at a speed of 0.1px/ms to the right, so its relative position (in css pixels) can be calculated in function of the time elapsed sinc...
WritableStreamDefaultWriter.desiredSize - Web APIs
of the writablestreamdefaultwriter interface returns the desired size required to fill the stream's internal queue. syntax var desiredsize = writablestreamdefaultwriter.desiredsize; value an integer. note that this can be negative if the queue is over-full. the value will be null if the stream cannot be successfully written to (due to either being errored, or having an abort queued up), and zero if the stream is closed. exceptions typeerror the writer’s lock is released. examples const writablestream = new writablestream({ write(chunk) { ... }, close() { ... }, abort(err) { ... } }, queuingstrategy); ... const writer = writablestream.getwriter(); ... // return stream's desired size let size = writer.desiredsize; specifications specificatio...
Using XMLHttpRequest - Web APIs
before calling open() on the request. otherwise the progress events will not fire. the progress event handler, specified by the updateprogress() function in this example, receives the total number of bytes to transfer as well as the number of bytes transferred so far in the event's total and loaded fields. however, if the lengthcomputable field is false, the total length is not known and will be zero. progress events exist for both download and upload transfers. the download events are fired on the xmlhttprequest object itself, as shown in the above sample. the upload events are fired on the xmlhttprequest.upload object, as shown below: var oreq = new xmlhttprequest(); oreq.upload.addeventlistener("progress", updateprogress); oreq.upload.addeventlistener("load", transfercomplete); oreq.upl...
XRInputSourcesChangeEvent - Web APIs
nt to an xrsession when the set of available webxr input controllers changes. constructor xrinputsourceschangeevent() creates and returns a new xrinputsourceschangeevent object configured as indicated by the given xrinputsourceschangeeventinit object. the specified type must be inputsourceschange, which is the only event that uses this interface. properties added read only an array of zero or more xrinputsource objects, each representing an input device which has been newly connected or enabled for use. removed read only an array of zero or more xrinputsource objects representing the input devices newly connected or enabled for use. session read only the xrsession to which this input source change event is being directed. methods while xrinputsourceschangeevent defines no ...
XRInputSourcesChangeEventInit.added - Web APIs
specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeeventinit.added' in that specification. working draft initial definition. ...
XRInputSourcesChangeEventInit - Web APIs
the xrinputsourceschangeeventinit dictionary is used to provide options to the xrinputsourceschangeevent() constructor in order to set the initial state of the new xrinputsourceschangeevent object. properties added read only an array of zero or more xrinputsource objects, each representing one input device which is newly available to use. removed read only an array of zero or more xrinputsource objects representing the input devices which are no longer available. session read only the xrsession to which the event applies. examples <tbd> specifications specification status comment webxr device apithe definition of 'xrinputsourceschangeeventinit' in that specification. working draft initial definition. ...
XRPermissionDescriptor.optionalFeatures - Web APIs
eference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the nati...
XRPermissionDescriptor.requiredFeatures - Web APIs
eference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the nati...
XRPermissionStatus.granted - Web APIs
eference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the nati...
XRReferenceSpace - Web APIs
eference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the nati...
XRReferenceSpaceType - Web APIs
eference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the nati...
XRSession.requestAnimationFrame() - Web APIs
g the time offset at which the updated viewer state was received from the webxr device. xrframe an xrframe object describing the state of the objects being tracked by the session. this can be used to obtain the poses of the viewer and the scene itself, as well as other information needed to render a frame of an ar or vr scene. return value an integer value which serves as a unique, non-zero id or handle you may pass to cancelanimationframe() if you need to remove the pending animation frame request. example the following example requests xrsession with "inline" mode so that it can be displayed in an html element (without the need for a separate ar or vr device). note: a real application should check that the device and the user agent support webxr api at all and then that they b...
XRSession.requestReferenceSpace() - Web APIs
eference space tries to keep the origin stable relative to the environment. xrreferencespace local-floor similar to the local type, except the starting position is placed in a safe location for the viewer to stand, where the value of the y axis is 0 at floor level. if that floor level isn't known, the user agent will estimate the floor level. if the estimated floor level is non-zero, the browser is expected to round it such a way as to avoid fingerprinting (likely to the nearest centimeter). xrreferencespace unbounded a tracking space which allows the user total freedom of movement, possibly over extremely long distances from their origin point. the viewer isn't tracked at all; tracking is optimized for stability around the user's current position, so the nati...
XRWebGLLayer.getNativeFramebufferScaleFactor() static method - Web APIs
buffer. this information can be used when creating a new xrwebgllayer to configure the xrwebgllayerinit property framebufferscalefactor in the options specified when calling the xrwebgllayer() constructor. see the usage notes and examples for details. if the scaling factor is 1.0, then the frame buffer pixels and the native display pixels are the same size. if the scaling factor is greater than zero, then the frame buffer is smaller than the diplay's native dimensions, resulting in the output being up-scaled for display to the screen after rendering into the frame buffer. if the scaling factor is less than zero, the frame buffer is larger than the native resolution of the display, resulting in the frame buffer's contents being scaled down for display to the xr device. this can happen for dis...
Keyboard-navigable JavaScript widgets - Accessibility
bindex attribute focusable with mouse or javascript via element.focus() tab navigable not present follows the platform convention of the element (yes for form controls, links, etc.). follows the platform convention of the element. negative (i.e. tabindex="-1") yes no; author must focus the element with focus() in response to arrow or other key presses. zero (i.e. tabindex="0") yes in tab order relative to element's position in document (note that interactive elements like <a> have this behavior by default, they don't need the attribute). positive (e.g. tabindex="33") yes tabindex value determines where this element is positioned in the tab order: smaller values will position elements earlier in the tab order than larger values (...
Mobile accessibility checklist - Accessibility
everything other than the currently visible screen must be truly invisible (especially relevant for single page apps with multiple cards): use the hidden attribute or visibility or display style properties. unless absolutely unavoidable, aria-hidden attribute should not be used. foc...
Keyboard - Accessibility
default; you can make an element focusable by adding a tabindex=0 attribute value to it. however, you should only add tabindex if you have also made the element interactive, for example, by defining appropriate event handlers keyboard events. see also tabindex global html attribute global event handlers: onkeydown global event handlers: onkeyup avoid using tabindex attribute greater than zero the tabindex attribute indicates that an element is focusable using the keyboard. a value of zero indicates that the element is part of the default focus order, which is based on the ordering of elements in the html document. a positive value puts the element ahead of those in the default ordering; elements with positive values are focused in the order of their tabindex values (1, then 2, then 3...
::-moz-progress-bar - CSS: Cascading Style Sheets
...
color-index - CSS: Cascading Style Sheets
the color-index css media feature can be used to test the number of entries in the output device's color lookup table. syntax the color-index feature is specified as an <integer> value representing the number of entries in the output device's color lookup table. (this value is zero if the device does not use such a table.) it is a range feature, meaning that you can also use the prefixed min-color-index and max-color-index variants to query minimum and maximum values, respectively. examples basic example html <p>this is a test.</p> css p { color: black; } @media (color-index) { p { color: red; } } @media (min-color-index: 15000) { p { color: #1475ef; } } result custom stylesheet this html will apply a special stylesheet for devices that have at least 256 colo...
color - CSS: Cascading Style Sheets
Web › CSS › @media › color
the color css media feature can be used to test the number of bits per color component (red, green, blue) of the output device. syntax the color feature is specified as an <integer> value that represents the number of bits per color component (red, green, blue) of the output device. if the device is not a color device, the value is zero. it is a range feature, meaning that you can also use the prefixed min-color and max-color variants to query minimum and maximum values, respectively. note: if the various color components are represented by different numbers of bits, the smallest number is used. for example, if a display uses 5 bits for blue and red and 6 bits for green, then the device is considered to use 5 bits per color component. if the device uses indexed colors, the minimum number ...
monochrome - CSS: Cascading Style Sheets
Web › CSS › @media › monochrome
the monochrome css media feature can be used to test the number of bits per pixel in the monochrome frame buffer of the output device. syntax the monochrome feature is specified as an <integer> representing the number of bits per pixel in the monochrome frame buffer. if the device is not a monochrome device, the value is zero. it is a range feature, meaning that you can also use the prefixed min-monochrome and max-monochrome variants to query minimum and maximum values, respectively. examples html <p class="mono">your device supports monochrome pixels!</p> <p class="no-mono">your device doesn't support monochrome pixels.</p> css p { display: none; } /* any monochrome device */ @media (monochrome) { p.mono { display: block; color: #333; } } /* any non-monochrome device *...
bleed - CSS: Cascading Style Sheets
Web › CSS › @page › bleed
the bleed css at-rule descriptor, used with the @page at-rule, specifies the extent of the page bleed area outside the page box. this property only has effect if crop marks are enabled using the marks property. syntax /* keyword values */ bleed: auto; /* <length> values */ bleed: 8pt; bleed: 1cm; values auto computes to 6pt if the value of marks is crop. otherwise it computes to zero. <length> specifies by how far outward, in each direction, the bleed area extends past the page box. values may be negative, but there may be implementation-specific limits. formal definition related at-rule@pageinitial valueautocomputed valueas specified formal syntax auto | <length> examples setting a page bleed of 1cm @page { bleed: 1cm; } specifications specification ...
Using URL values for the cursor property - CSS: Cascading Style Sheets
gecko 1.8 supports url values for the css cursor property on windows and linux. mac support was added in gecko 2 (firefox 4). this allows specifying arbitrary images as mouse cursors — any image format supported by gecko can be used. syntax the basic (css 2.1) syntax for this property is: cursor: [ <url> , ]* <keyword> this means that zero or more urls may be specified (comma-separated), which must be followed by one of the keywords defined in the css specification, such as auto or pointer. for example, the following value would be allowed: cursor: url(foo.cur), url(http://www.example.com/bar.gif), auto; this will first try loading foo.cur. if that file does not exist or is not valid for some other reason, bar.gif is tried, and if that can't be used either, auto will be used. suppor...
Mastering margin collapsing - CSS: Cascading Style Sheets
collapsed margin ends up outside the parent. empty blocks if there is no border, padding, inline content, height, or min-height to separate a block's margin-top from its margin-bottom, then its top and bottom margins collapse. some things to note: more complex margin collapsing (of more than two margins) occurs when the above cases are combined. these rules apply even to margins that are zero, so the margin of a descendant ends up outside its parent (according to the rules above) whether or not the parent's margin is zero. when negative margins are involved, the size of the collapsed margin is the sum of the largest positive margin and the smallest (most negative) negative margin. when all margins are negative, the size of the collapsed margin is the smallest (most negative) margin.
Using CSS gradients - CSS: Cascading Style Sheets
ike! by default, colors are evenly spaced along the gradient. <div class="auto-spaced-linear-gradient"></div> div { width: 120px; height: 120px; } .auto-spaced-linear-gradient { background: linear-gradient(red, yellow, blue, orange); } positioning color stops you don't have to leave your color stops at their default positions. to fine-tune their locations, you can give each one zero, one, or two percentage or, for radial and linear gradients, absolute length values. if you specify the location as a percentage, 0% represents the starting point, while 100% represents the ending point; however, you can use values outside that range if necessary to get the effect you want. if you leave a location unspecified, the position of that particular color stop will be automatically calcu...
Consistent list indentation - CSS: Cascading Style Sheets
ul {margin-left: 0; padding-left: 40px;} if you're more interested in following the internet explorer/opera model, then: ul {margin-left: 40px; padding-left: 0;} of course, you can fill in your own preferred values. set both to 1.25em, if you like -- there's no reason why you have to stick with pixel-based indentation. if you want to reset lists to have no indentation, then you still have to zero out both padding and margin: ul {margin-left: 0; padding-left: 0;} remember, though, that in so doing, you'll have the bullets hanging outside the list and its parent element. if the parent is the body, there's a strong chance your bullets will be completely outside the browser window, and thus will not be visible. conclusion in the end, we can see that none of the browsers mentioned in this ...
Stacking context example 1 - CSS: Cascading Style Sheets
t we have two divs (div #1 and div #3), both relatively positioned, but without z-index properties. inside div #1 there is an absolutely positioned div #2, while in div #3 there is an absolutely positioned div #4, both without z-index properties. the only stacking context is the root context. without z-indexes, elements are stacked in order of occurrence. if div #2 is assigned a positive (non-zero and non-auto) z-index value, it is rendered above all the other divs. then if div #4 is also assigned a positive z-index greater than div #2's z-index, it is rendered above all the other divs including div #2. in this last example you can see that div #2 and div #4 are not siblings, because they belong to different parents in the html elements' hierarchy. even so, stacking of div #4 with re...
CSS data types - CSS: Cascading Style Sheets
Web › CSS › CSS Types
see also css units and values introduction to css: values and units ...
CSS values and units - CSS: Cascading Style Sheets
nt and vh is relative to the viewport height. relative length units unit relative to em font size of the element. ex x-height of the element's font. cap cap height (the nominal height of capital letters) of the element's font. ch average character advance of a narrow glyph in the element’s font, as represented by the “0” (zero, u+0030) glyph. ic average character advance of a full width glyph in the element’s font, as represented by the “水” (cjk water ideograph, u+6c34) glyph. rem font size of the root element. lh line height of the element. rlh line height of the root element. vw 1% of viewport's width. vh 1% of viewport's height. ...
Specificity - CSS: Cascading Style Sheets
: orange; } div:not(.outer) p { color: blueviolet; } ... when used with the following html ... <div class="outer"> <p>this is in the outer div.</p> <div class="inner"> <p>this text is in the inner div.</p> </div> </div> ... appears on the screen like this: the :where() exception the specificity-adjustment pseudo-class :where() always has its specificity replaced with zero. this chunk of css ... div:where(.outer) p { color: orange; } div p { color: blueviolet; } #no-where-support { margin: 0.5em; border: 1px solid red; } #no-where-support:where(*) { display: none !important; } ... when used with the following html ... <div id="no-where-support"> ⚠️ your browser doesn't support the <code><a href="/docs/web/css/:where" target="_top">:where()...
animation-duration - CSS: Cascading Style Sheets
tion to set all animation properties at once. syntax /* single animation */ animation-duration: 6s; animation-duration: 120ms; /* multiple animations */ animation-duration: 1.64s, 15.22s; animation-duration: 10s, 35s, 230ms; values <time> the time that an animation takes to complete one cycle. this may be specified in either seconds (s) or milliseconds (ms). the value must be positive or zero and the unit is required. a value of 0s, which is the default value, indicates that no animation should occur. note: negative values are invalid, causing the declaration to be ignored. some early, prefixed, implementations may consider them as identical to 0s. note: when you specify multiple comma-separated values on an animation-* property, they will be assigned to the animations specified...
background-position - CSS: Cascading Style Sheets
the right container edge) -250px (left image edge 250px to the left of the container, in this example that puts the right edge of the 300px-wide image in the center of the container) it's worth mentioning that if your background-size is equal to the container size for a given axis, then a percentage position for that axis will have no effect because the "container-image difference" will be zero. you will need to offset using absolute values. formal definition initial value0% 0%applies toall elements. it also applies to ::first-letter and ::first-line.inheritednopercentagesrefer to the size of the background positioning area minus size of background image; size refers to the width for horizontal offsets and to the height for vertical offsetscomputed valuea list, each item consisting...
background - CSS: Cascading Style Sheets
mage> and <repeat-style> */ background: url("test.jpg") repeat-y; /* using a <box> and <background-color> */ background: border-box red; /* a single image, centered and scaled */ background: no-repeat center/80% url("../img/image.png"); the background property is specified as one or more background layers, separated by commas. the syntax of each layer is as follows: each layer may include zero or one occurrences of any of the following values: <attachment> <bg-image> <position> <bg-size> <repeat-style> the <bg-size> value may only be included immediately after <position>, separated with the '/' character, like this: "center/80%". the <box> value may be included zero, one, or two times. if included once, it sets both background-origin and background-clip. if it ...
<basic-shape> - CSS: Cascading Style Sheets
s here are resolved against the used width (for the rx value) and the used height (for the ry value) of the reference box. the position argument defines the center of the ellipse. this defaults to center if omitted. polygon() polygon( [<fill-rule>,]? [<shape-arg> <shape-arg>]# ) <fill-rule> represents the filling rule used to determine the interior of the polygon. possible values are nonzero and evenodd. default value when omitted is nonzero. each pair argument in the list represents xi and yi - the x and y axis coordinates of the ith vertex of the polygon. path() path( [<fill-rule>,]? <string>) the optional <fill-rule> represents the filling rule used to determine the interior of the path. possible values are nonzero and evenodd. default value when omitted is nonzero. th...
border-width - CSS: Cascading Style Sheets
er-top-width: a length formal syntax <line-width>{1,4}where <line-width> = <length> | thin | medium | thick examples a mix of values and lengths html <p id="sval"> one value: 6px wide border on all 4 sides</p> <p id="bival"> two different values: 2px wide top and bottom border, 10px wide right and left border</p> <p id="treval"> three different values: 0.3em top, 9px bottom, and zero width right and left</p> <p id="fourval"> four different values: "thin" top, "medium" right, "thick" bottom, and 1em left</p> css #sval { border: ridge #ccc; border-width: 6px; } #bival { border: solid red; border-width: 2px 10px; } #treval { border: dotted orange; border-width: 0.3em 0 9px; } #fourval { border: solid lightgreen; border-width: thin medium thick 1em; } p { ...
calc() - CSS: Cascading Style Sheets
Web › CSS › calc
as a percentage followed by a negative length — an invalid expression — while calc(50% - 8px) is a percentage followed by a subtraction operator and a length. likewise, calc(8px + -50%) is treated as a length followed by an addition operator and a negative percentage. the * and / operators do not require whitespace, but adding it for consistency is both allowed and recommended. division by zero results in an error being generated by the html parser. math expressions involving percentages for widths and heights on table columns, table column groups, table rows, table row groups, and table cells in both auto and fixed layout tables may be treated as if auto had been specified. it is permitted to nest calc() functions, in which case the inner ones are treated as simple parentheses. for...
clip-path - CSS: Cascading Style Sheets
Web › CSS › clip-path
argin-boxwhere <length-percentage> = <length> | <percentage><shape-radius> = <length-percentage> | closest-side | farthest-side<position> = [ [ left | center | right ] | [ top | center | bottom ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? ...
column-gap (grid-column-gap) - CSS: Cascading Style Sheets
ive. <percentage> the size of the gap between columns, defined as a <percentage>. the <percentage> property's value must be non-negative. ...
column-width - CSS: Cascading Style Sheets
available space, and narrower when the available space is too small. the value must be strictly positive or the declaration is invalid. percentage values are also invalid. auto the width of the column is determined by other css properties, such as column-count. formal definition initial valueautoapplies toblock containers except table wrapper boxesinheritednocomputed valuethe absolute length, zero or largeranimation typea length formal syntax <length> | auto examples setting column width in pixels html <p class="content-box"> lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo ...
columns - CSS: Cascading Style Sheets
Web › CSS › columns
neither this value nor the column's width are auto, it merely indicates the maximum allowable number of columns. see column-count. formal definition initial valueas each of the properties of the shorthand:column-width: autocolumn-count: autoapplies toblock containers except table wrapper boxesinheritednocomputed valueas each of the properties of the shorthand:column-width: the absolute length, zero or largercolumn-count: as specifiedanimation typeas each of the properties of the shorthand:column-width: a lengthcolumn-count: an integer formal syntax <'column-width'> | <'column-count'> examples setting three equal columns html <p class="content-box"> this is a bunch of text split into three columns using the css `columns` property. the text is equally distributed over the columns.
counter() - CSS: Cascading Style Sheets
Web › CSS › counter
unter-style-name> | symbols()where <counter-style-name> = <custom-ident> examples default value compared to upper roman html <ol> <li></li> <li></li> <li></li> </ol> css ol { counter-reset: listcounter; } li { counter-increment: listcounter; } li::after { content: "[" counter(listcounter) "] == [" counter(listcounter, upper-roman) "]"; } result decimal-leading-zero compared to lower-alpha html <ol> <li></li> <li></li> <li></li> </ol> css ol { counter-reset: count; } li { counter-increment: count; } li::after { content: "[" counter(count, decimal-leading-zero) "] == [" counter(count, lower-alpha) "]"; } result specifications specification status comment css lists module level 3the definition of ...
cursor - CSS: Cascading Style Sheets
Web › CSS › cursor
xamples and send us a pull request. syntax /* keyword value */ cursor: pointer; cursor: auto; /* url, with a keyword fallback */ cursor: url(hand.cur), pointer; /* url and coordinates, with a keyword fallback */ cursor: url(cursor1.png) 4 12, auto; cursor: url(cursor2.png) 2 2, pointer; /* global values */ cursor: inherit; cursor: initial; cursor: unset; the cursor property is specified as zero or more <url> values, separated by commas, followed by a single mandatory keyword value. each <url> should point to an image file. the browser will try to load the first image specified, falling back to the next if it can't, and falling back to the keyword value if no images could be loaded (or if none were specified). each <url> may be optionally followed by a pair of space-separated numbers, w...
<custom-ident> - CSS: Cascading Style Sheets
ne. counter-reset counter-increment forbids the global css values (unset, initial, and inherit), as well as none. @counter-style list-style-type forbids the global css values (unset, initial, and inherit), as well as the values none, inline, and outside. ...
<easing-function> - CSS: Cascading Style Sheets
nts are fixed as the coordinates are ratios (the abscissa the ratio of time, the ordinate the ratio of the output range). p0 is (0, 0) and represents the initial time and the initial state, p3 is (1, 1) and represents the final time and the final state. not all cubic bézier curves are suitable as easing functions as not all are mathematical functions; i.e., curves that for a given abscissa have zero or one value. with p0 and p3 fixed as defined by css, a cubic bézier curve is a function, and is therefore valid, if and only if the abscissas of p1 and p2 are both in the [0, 1] range. cubic bézier curves with the p1 or p2 ordinate outside the [0, 1] range may generate bouncing effects. when you specify an invalid cubic-bezier curve, css ignores the whole property. syntax cubic-bezier(x1, ...
font-size-adjust - CSS: Cascading Style Sheets
at its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. the number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. this means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust. 0 yields text of zero height (hidden text). formal definition initial valuenoneapplies toall elements. it also applies to ::first-letter and ::first-line.inheritedyescomputed valueas specifiedanimation typea number formal syntax none | <number> examples adjusting lower-case letter sizes html <p class="times">this text uses the times font (10px), which is hard to read in small sizes.</p> <p class="verdana">th...
<frequency-percentage> - CSS: Cascading Style Sheets
s 90% positive percentage +90% positive percentage with leading + -90% negative percentage — not valid for all properties that use percentages invalid percentage values 90 % no space is allowed between the number and the unit valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended. +0hz zero, with a leading + and a unit -0khz zero, with a leading - and a unit invalid frequency values 12.0 this is a <number>, not an <frequency>, because it is missing a unit. 7 hz no space is allowed between the number and the unit. 0 although unitless zero is an allowable <length>, it's an invalid <frequency>. specifications specification status comment ...
<frequency> - CSS: Cascading Style Sheets
Web › CSS › frequency
unit, the unit may not be omitted. in other words, 0 is invalid and does not represent 0hz or 0khz. though the units are case-insensitive, it is good practice to use a capital "h" for hz and khz, as specified in the si. examples valid frequency values 12hz positive integer 4.3hz non-integer 14khz the unit is case-insensitive, though non-si capitalization is not recommended. +0hz zero, with a leading + and a unit -0khz zero, with a leading - and a unit invalid frequency values 12.0 this is a <number>, not an <frequency>, because it is missing a unit. 7 hz no space is allowed between the number and the unit. 0 although unitless zero is an allowable <length>, it's an invalid <frequency>. specifications specification status comment ...
grid-auto-columns - CSS: Cascading Style Sheets
esenting the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) is a functional notation that defines a size range greater than or equal to min and less than or equal to max. if max is smaller than min, then max is ignored and the function is treated as min. as a maximum, a <flex> value sets the track’s flex factor. as a minimum, it is treated as zero (or minimal content, if the grid container is sized under a minimal content constraint). fit-content(argument) represents the formula min(max-content, max(auto, argument)), which is calculated similar to auto (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is greater than the auto minimum. auto is a keyword that is identical to maximal content if it's...
grid-auto-rows - CSS: Cascading Style Sheets
esenting the largest minimal content contribution of the grid items occupying the grid track. minmax(min, max) is a functional notation that defines a size range greater than or equal to min and less than or equal to max. if max is smaller than min, then max is ignored and the function is treated as min. as a maximum, a <flex> value sets the track’s flex factor. as a minimum, it is treated as zero (or minimal content, if the grid container is sized under a minimal content constraint). auto is a keyword that is identical to maximal content if it's a maximum. as a minimum it represents the largest minimum size (as specified by min-width/min-height) of the grid items occupying the grid track. note: auto track sizes (and only auto track sizes) can be stretched by the align-content and jus...
image() - CSS: Cascading Style Sheets
hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> where: image-tagsoptional the directionality of the image, either ltr for left-to-right or rtl for right-to-left. image-src optional zero or more <url>s or <string>s specifying the image sources, with optional image fragment identifiers. coloroptional a color, specifying a solid background color to use as a fallback if no image-src is found, supported, or declared. bi-directional awareness the first, optional parameter of the image() notation is the directionality of the image. if included, and the image is used on an element ...
initial-letter - CSS: Cascading Style Sheets
word value normal, or a <number> optionally followed by an <integer>. values normal no special initial-letter effect. text behaves as normal. <number> defines the size of the initial letter, in terms of how many lines it occupies. negative values are not allowed. <integer> defines the number of lines the initial letter should sink when the size of it is given. values must be greater than zero. if omitted, it duplicates the size value, floored to the nearest positive whole number. formal definition initial valuenormalapplies to::first-letter pseudo-elements and inline-level first child of a block containerinheritednocomputed valueas specifiedanimation typediscrete formal syntax normal | [ <number> <integer>? ] examples setting initial letter size html <p class="normal">initial...
<integer> - CSS: Cascading Style Sheets
Web › CSS › integer
calculation is done as if they were real, floating-point numbers; the discrete value is obtained using the floor function. the speed of the interpolation is determined by the timing function associated with the animation. examples valid integers 12 positive integer (without a leading + sign) +123 positive integer (with a leading + sign) -456 negative integer 0 zero +0 zero, with a leading + -0 zero, with a leading - invalid integers 12.0 this is a <number>, not an <integer>, though it represents an integer. 12. decimal points are not allowed. +---12 only one leading +/- is allowed. ten letters are not allowed. _5 special characters are not allowed. \35 escaped unicode characters are not allow...
<length> - CSS: Cascading Style Sheets
Web › CSS › length
in effect in an element or its parent. note: these units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the user changes the font size. cap represents the "cap height" (nominal height of capital letters) of the element’s font. ch represents the width, or more precisely the advance measure, of the glyph "0" (zero, the unicode character u+0030) in the element's font. in the cases where it is impossible or impractical to determine the measure of the “0” glyph, it must be assumed to be 0.5em wide by 1em tall. em represents the calculated font-size of the element. if used on the font-size property itself, it represents the inherited font-size of the element. ex represents the x-height of the elemen...
list-style - CSS: Cascading Style Sheets
ck if the image is unavailable. values list-style-type see list-style-type. list-style-image see list-style-image. list-style-position see list-style-position. none no list style is used. accessibility concerns safari has an issue whereby unordered lists with a list-style value of none applied to them will not be recognized as a list in the accessibility tree. to address this, add a zero-width space as pseudo-content before each list item to ensure the list is recognized properly. this ensures the design is unaffected by the bug fix and that list items are not improperly described. ul { list-style: none; } ul li::before { content: "\200b"; } voiceover and list-style-type: none – unfettered thoughts mdn understanding wcag, guideline 1.3 explanations understanding suc...
margin-bottom - CSS: Cascading Style Sheets
e length */ margin-bottom: 1em; /* relative to the text size */ margin-bottom: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-bottom: auto; /* global values */ margin-bottom: inherit; margin-bottom: initial; margin-bottom: unset; the margin-bottom property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the browser selects a suitable value to use. see margin. formal definition initial value0applies toall elements, except elements with table display types other than table-caption, table and inline-table. it also...
margin-left - CSS: Cascading Style Sheets
/* an absolute length */ margin-left: 1em; /* relative to the text size */ margin-left: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-left: auto; /* global values */ margin-left: inherit; margin-left: initial; margin-left: unset; the margin-left property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the left margin receives a share of the unused horizontal space, as determined mainly by the layout mode that is used. if the values of margin-left and margin-right are both auto, the calculated space is evenly dis...
margin-right - CSS: Cascading Style Sheets
absolute length */ margin-right: 1em; /* relative to the text size */ margin-right: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-right: auto; /* global values */ margin-right: inherit; margin-right: initial; margin-right: unset; the margin-right property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the right margin receives a share of the unused horizontal space, as determined mainly by the layout mode that is used. if the values of margin-left and margin-right are both auto, the calculated space is evenly di...
margin-top - CSS: Cascading Style Sheets
10px; /* an absolute length */ margin-top: 1em; /* relative to the text size */ margin-top: 5%; /* relative to the nearest block container's width */ /* keyword values */ margin-top: auto; /* global values */ margin-top: inherit; margin-top: initial; margin-top: unset; the margin-top property is specified as the keyword auto, or a <length>, or a <percentage>. its value can be positive, zero, or negative. values <length> the size of the margin as a fixed value. <percentage> the size of the margin as a percentage, relative to the width of the containing block. auto the browser selects a suitable value to use. see margin. formal definition initial value0applies toall elements, except elements with table display types other than table-caption, table and inline-table. it also...
margin-trim - CSS: Cascading Style Sheets
it also truncates any margins collapsed with such a margin. all trims the margins of in-flow boxes and floats whose margins coincide with the container's content edge. ...
<number> - CSS: Cascading Style Sheets
Web › CSS › number
is no unit associated with numbers. interpolation when animated, values of the <number> css data type are interpolated as real, floating-point numbers. the speed of the interpolation is determined by the timing function associated with the animation. examples valid numbers 12 a raw <integer> is also a <number>. 4.01 positive fraction -456.8 negative fraction 0.0 zero +0.0 zero, with a leading + -0.0 zero, with a leading - .60 fractional number without a leading zero 10e3 scientific notation -3.4e-2 complicated scientific notation invalid numbers 12. decimal points must be followed by at least one digit. +-12.2 only one leading +/- is allowed. 12.1.1 only one decimal point is allowed. specifications ...
offset-path - CSS: Cascading Style Sheets
<basic-shape> | <geometry-box> ]where <size> = closest-side | farthest-side | closest-corner | farthest-corner | <length> | <length-percentage>{2}<path()> = path( [ <fill-rule>, ]? <string> )<basic-shape> = <inset()> | <circle()> | <ellipse()> | <polygon()> | <path()><geometry-box> = <shape-box> | fill-box | stroke-box | view-boxwhere <length-percentage> = <length> | <percentage><fill-rule> = nonzero | evenodd<inset()> = inset( <length-percentage>{1,4} [ round <'border-radius'> ]? )<circle()> = circle( [ <shape-radius> ]? [ at <position> ]? )<ellipse()> = ellipse( [ <shape-radius>{2} ]? [ at <position> ]? )<polygon()> = polygon( <fill-rule>? , [ <length-percentage> <length-percentage> ]# )<shape-box> = <box> | margin-boxwhere <shape-radius> = <length-percentage> | closest-side | farthest-side...
repeat() - CSS: Cascading Style Sheets
Web › CSS › repeat
to or spanning across it. (this can result in all tracks being collapsed, if they’re all empty.) a collapsed track is treated as having a single fixed track sizing function of 0px, and the gutters on either side of it collapse. for the purpose of finding the number of auto-repeated tracks, the user agent floors the track size to a user agent specified value (e.g., 1px), to avoid division by zero. examples specifying grid columns using repeat() html <div id="container"> <div> this item is 50 pixels wide. </div> <div> item with flexible width. </div> <div> this item is 50 pixels wide. </div> <div> item with flexible width. </div> <div> inflexible item of 100 pixels width. </div> </div> css #container { display: grid; grid-template-column...
row-gap (grid-row-gap) - CSS: Cascading Style Sheets
Web › CSS › row-gap
<length-percentage> is the width of the gutter separating the rows. <percentage> values are relative to the dimension of the element. ...
scroll-padding-block-end - CSS: Cascading Style Sheets
%; /* global values */ scroll-padding-block-end: inherit; scroll-padding-block-end: initial; scroll-padding-block-end: unset; values <length-percentage> an inwards offset from the block end edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> specifications specification status comment css scrol...
scroll-padding-block-start - CSS: Cascading Style Sheets
lobal values */ scroll-padding-block-start: inherit; scroll-padding-block-start: initial; scroll-padding-block-start: unset; values <length-percentage> an inwards offset from the block start edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> specifications specification status comment css scrol...
scroll-padding-block - CSS: Cascading Style Sheets
lock: 10%; /* global values */ scroll-padding-block: inherit; scroll-padding-block: initial; scroll-padding-block: unset; values <length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax [ auto | <length-percentage> ]{1,2}where <length-percentage> = <length> | <percentage> specifications specification status comment ...
scroll-padding-bottom - CSS: Cascading Style Sheets
g-bottom: 10%; /* global values */ scroll-padding-bottom: inherit; scroll-padding-bottom: initial; scroll-padding-bottom: unset; values <length-percentage> an inwards offset from the bottom edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> specifications specification status comment css scrol...
scroll-padding-inline-end - CSS: Cascading Style Sheets
/* global values */ scroll-padding-inline-end: inherit; scroll-padding-inline-end: initial; scroll-padding-inline-end: unset; values <length-percentage> an inwards offset from the inline end edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> specifications specification status comment css scroll...
scroll-padding-inline-start - CSS: Cascading Style Sheets
l values */ scroll-padding-inline-start: inherit; scroll-padding-inline-start: initial; scroll-padding-inline-start: unset; values <length-percentage> an inwards offset from the inline start edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> specifications specification status comment css scrol...
scroll-padding-inline - CSS: Cascading Style Sheets
e: 10%; /* global values */ scroll-padding-inline: inherit; scroll-padding-inline: initial; scroll-padding-inline: unset; values <length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax [ auto | <length-percentage> ]{1,2}where <length-percentage> = <length> | <percentage> specifications specification status comment ...
scroll-padding-left - CSS: Cascading Style Sheets
oll-padding-left: 10%; /* global values */ scroll-padding-left: inherit; scroll-padding-left: initial; scroll-padding-left: unset; values <length-percentage> an inwards offset from the left edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> specifications specification status comment css scroll...
scroll-padding-right - CSS: Cascading Style Sheets
-padding-right: 10%; /* global values */ scroll-padding-right: inherit; scroll-padding-right: initial; scroll-padding-right: unset; values <length-percentage> an inwards offset from the top edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> specifications specification status comment css scrol...
scroll-padding-top - CSS: Cascading Style Sheets
; scroll-padding-top: 10%; /* global values */ scroll-padding-top: inherit; scroll-padding-top: initial; scroll-padding-top: unset; values <length-percentage> an inwards offset from the top edge of the scrollport, as a valid length or a percentage. auto the offset is determind by the user agent. this will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax auto | <length-percentage>where <length-percentage> = <length> | <percentage> specifications specification status comment css scrol...
scroll-padding - CSS: Cascading Style Sheets
; scroll-padding: 10%; /* global values */ scroll-padding: inherit; scroll-padding: initial; scroll-padding: unset; values <length-percentage> an inwards offset from the corresponding edge of the scrollport, as a valid <length> or a <percentage>. auto the offset is determind by the user agent. this will generally be 0px, but the user agent is free to detect and do something else if a non-zero value is more appropriate. formal definition initial valueautoapplies toscroll containersinheritednopercentagesrelative to the scroll container's scrollportcomputed valueas specifiedanimation typeby computed value type formal syntax [ auto | <length-percentage> ]{1,4}where <length-percentage> = <length> | <percentage> specifications specification status comment ...
<time-percentage> - CSS: Cascading Style Sheets
optional plus sign -50% negative percentages are not valid for all properties that accept percentages invalid percentages 50 % space not allowed between the space and the percentage sign valid times 12s positive integer -456ms negative integer 4.3ms non-integer 14ms the unit is case-insensitive, although capital letters are not recommended. +0s zero with a leading + and a unit -0ms zero with a leading - and a unit invalid times 0 although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 this is a <number>, not a <time>, because it's missing a unit. 7 ms no space is allowed between the number and the unit. specifications specification status comment css val...
<time> - CSS: Cascading Style Sheets
Web › CSS › time
ts a time in seconds. examples: 0s, 1.5s, -60s. ms represents a time in milliseconds. examples: 0ms, 150.25ms, -60000ms. note: conversion between s and ms follows the logical 1s = 1000ms. examples valid times 12s positive integer -456ms negative integer 4.3ms non-integer 14ms the unit is case-insensitive, although capital letters are not recommended. +0s zero with a leading + and a unit -0ms zero with a leading - and a unit invalid times 0 although unitless zero is allowed for <length>s, it's invalid for <time>s. 12.0 this is a <number>, not a <time>, because it's missing a unit. 7 ms no space is allowed between the number and the unit. specifications specification status comment css val...
transition-delay - CSS: Cascading Style Sheets
the transition-delay css property specifies the duration to wait before starting a property's transition effect when its value changes. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the delay may be zero, positive, or negative: a value of 0s (or 0ms) will begin the transition effect immediately. a positive value will delay the start of the transition effect for the given length of time. a negative value will begin the transition effect immediately, and partway through the effect. in other words, the effect will be animated as if it had already been running for the given length of time. you may specify multi...
transition - CSS: Cascading Style Sheets
all changed properties */ transition: all 0.5s ease-out; /* global values */ transition: inherit; transition: initial; transition: unset; the transition property is specified as one or more single-property transitions, separated by commas. each single-property transition describes the transition that should be applied to a single property (or the special values all and none). it includes: zero or one value representing the property to which the transition should apply. this may be any one of: the keyword none the keyword all a <custom-ident> naming a css property. zero or one <single-transition-timing-function> value representing the timing function to use zero, one, or two <time> values. the first value that can be parsed as a time is assigned to the transition-dura...
visibility - CSS: Cascading Style Sheets
s and columns is still calculated as though the cells in the collapsed row(s) or column(s) are present. this value allows for the fast removal of a row or column from a table without forcing the recalculation of widths and heights for the entire table. collapsed flex items are hidden, and the space they would have occupied is removed. for xul elements, the computed size of the element is always zero, regardless of other styles that would normally affect the size, although margins still take effect. for other elements, collapse is treated the same as hidden. accessibility concerns using a visibility value of hidden on an element will remove it from the accessibility tree. this will cause the element and all its descendant elements to no longer be announced by screen reading technology. i...
HTML attribute: max - HTML: Hypertext Markup Language
Web › HTML › Attributes › max
he user doesn't adhere to the maximum value set, the value is considered invalid in contraint validation and will match the :invalid and :out-of-range pseudoclasses see client-side validation and rangeoverflow for more information. for the<progress> element, the max attribute describes how much work the task indicated by the progress element requires. if present, must have a value greater than zero and be a valid floating point number. for the <meter> element, the max attribute defines the upper numeric bound of the measured range. this must be greater than the minimum value (min attribute), if specified. in both cases, if omitted, the value defaults to 1. syntax for max values for other elements input type syntax example <progress> <number> <progress id...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
Web › HTML › Element › applet
tml applet element (<applet>) embeds a java applet into the document; this element has been deprecated in favor of <object>. use of java applets on the web is deprecated; most browsers no longer support use of plug-ins, including the java plug-in. content categories flow content, phrasing content, embedded content, interactive content, palpable content. permitted content zero or more <param> elements, then transparent. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts embedded content. dom interface htmlappletelement attributes align this attribute is used to position the applet on the page relative to content that might flow around it. the html 4.01 specificatio...
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
Web › HTML › Element › audio
line 1.2 explanations understanding success criterion 1.2.1 | w3c understanding wcag 2.0 understanding success criterion 1.2.2 | w3c understanding wcag 2.0 technical summary content categories flow content, phrasing content, embedded content. if it has a controls attribute: interactive content and palpable content. permitted content if the element has a src attribute: zero or more <track> elements followed by transparent content that contains no <audio> or <video> media elements. else: zero or more <source> elements followed by zero or more <track> elements followed by transparent content that contains no <audio> or <video> media elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element th...
<col> - HTML: Hypertext Markup Language
Web › HTML › Element › col
are none, the left value is assumed. note: to achieve the same effect as the left, center, right or justify values: do not try to set the text-align property on a selector giving a <col> element. because <td> elements are not descendant of the <col> element, they won't inherit it. if the table doesn't use a colspan attribute, use the td:nth-child(an+b) css selector. set a to zero and b to the position of the column in the table, e.g. td:nth-child(2) { text-align: right; } to right-align the second column. if the table does use a colspan attribute, the effect can be achieved by combining adequate css attribute selectors like [colspan=n], though this is not trivial. bgcolor the background color of the table. it is a 6-digit hexadecimal rgb code, prefi...
<colgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › colgroup
e. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content if the span attribute is present: none, it is an empty element. if the attribute is not present: zero or more <col> element tag omission the start tag may be omitted, if it has a <col> element as its first child and if it is not preceded by a <colgroup> whose end tag has been omitted. the end tag may be omitted, if it is not followed by a space or a comment. permitted parents a <table> element. the <colgroup> must appear after any optional <caption> element but before ...
<datalist>: The HTML Data List element - HTML: Hypertext Markup Language
Web › HTML › Element › datalist
ns available to choose from within other controls. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, phrasing content. permitted content either phrasing content or zero or more <option> elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role listbox permitted aria roles no role permitted dom interface htmldatalistelement attributes this element has no other attributes than the global attributes, ...
<dl>: The Description List element - HTML: Hypertext Markup Language
Web › HTML › Element › dl
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, and if the <dl> element's children include one name-value group, palpable content. permitted content either: zero or more groups each consisting of one or more <dt> elements followed by one or more <dd> elements, optionally intermixed with <script> and <template> elements. or: one or more <div> elements, optionally intermixed with <script> and <template> elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flo...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
Web › HTML › Element › head
marily holds information for machine processing, not human-readability. for human-visible information, like top-level headings and listed authors, see the <header> element. content categories none. permitted content if the document is an <iframe> srcdoc document, or if title information is available from a higher level protocol (like the subject line in html email), zero or more elements of metadata content. otherwise, one or more elements of metadata content where exactly one is a <title> element. tag omission the start tag may be omitted if the first thing inside the <head> element is an element. the end tag may be omitted if the first thing following the <head> element is not a space character or a comment. permitted parents ...
<input type="password"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › password
still be changed from javascript code that directly sets the value of the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or wider than the specified number of characters, depending on the characters and the font (font settings in use). this does not set a limit on how many characters the user can enter into the field. it only specifies approximately how...
<input type="search"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › search
lue can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or wider than the specified number of characters, depending on the characters and the font (font settings in use). this does not set a limit on how many characters the user can enter into the field. it only specifies approximately how...
<input type="tel"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › tel
lue can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or wider than the specified number of characters, depending on the characters and the font (font settings in use). this does not set a limit on how many characters the user can enter into the field. it only specifies approximately how...
<input type="text"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › text
lue can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or wider than the specified number of characters, depending on the characters and the font (font settings in use). this does not set a limit on how many characters the user can enter into the field. it only specifies approximately how...
<input type="url"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › url
lue can, however, still be changed by javascript code directly setting the htmlinputelement.value property. note: because a read-only field cannot have a value, required does not have any effect on inputs with the readonly attribute also specified. size the size attribute is a numeric value indicating how many characters wide the input field should be. the value must be a number greater than zero, and the default value is 20. since character widths vary, this may or may not be exact and should not be relied upon to be so; the resulting input may be narrower or wider than the specified number of characters, depending on the characters and the font (font settings in use). this does not set a limit on how many characters the user can enter into the field. it only specifies approximately how...
<keygen> - HTML: Hypertext Markup Language
Web › HTML › Element › keygen
nd then digitally signed with the private key to produce a signedpublickeyandchallenge. the signedpublickeyandchallenge is base64 encoded, and the ascii data is finally submitted to the server as the value of a form name/value pair, where the name is name as specified by the name attribute of the keygen element. if no challenge string is provided, then it will be encoded as an ia5string of length zero. here is an example form submission as it would be delivered to a cgi program by the http server: commonname=john+doe&email=doe@foo.com&org=foobar+computing+corp.& orgunit=bureau+of+bureaucracy&locality=anytown&state=california&country=us& key=mihfmhewxdanbgkqhkig9w0baqefaanladbiakeanx0tiljromuue%2bptwbre6xfv%0awtkqbsshxk5zhcuwcwyvcniq9b82qhjdoacdd34rqfcaind46fxkqunb0mvkzqid%0aaqabfhfn...
<menu> - HTML: Hypertext Markup Language
Web › HTML › Element › menu
nus, which might appear across the top of a screen, as well as context menus, such as those that might appear underneath a button after it has been clicked. content categories flow content. if the element's children include at least one <li> element: palpable content. permitted content if the element is in the list menu state: flow content, or alternatively, zero or more occurrences of <li>, <script>, and <template>. (list menu is the default state, unless the parent element is a <menu> in the context menu state.) if the element is in the context menu state: zero or more occurrences, in any order, of <menu> (context menu state only), <menuitem>, <hr>, <script>, and <template>. tag omission none, both the starting and ending tag are ma...
<noscript> - HTML: Hypertext Markup Language
Web › HTML › Element › noscript
the html <noscript> element defines a section of html to be inserted if a script type on the page is unsupported or if scripting is currently turned off in the browser. content categories metadata content, flow content, phrasing content. permitted content when scripting is disabled and when it is a descendant of the <head> element: in any order, zero or more <link> elements, zero or more <style> elements, and zero or more <meta> elements. when scripting is disabled and when it isn't a descendant of the <head> element: any transparent content, but no <noscript> element must be among its descendants. otherwise: flow content or phrasing content. tag omission none, both the starting and ending tag are mandatory. permitted parents any elemen...
<object> - HTML: Hypertext Markup Language
Web › HTML › Element › object
b repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content; phrasing content; embedded content, palpable content; if the element has a usemap attribute, interactive content; listed, submittable form-associated element. permitted content zero or more <param> elements, then transparent. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts embedded content. implicit aria role no corresponding role permitted aria roles application, document, image dom interface htmlobjectelement attributes this element includes the...
<ol>: The Ordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ol
d list. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, and if the <ol> element's children include at least one <li> element, palpable content. permitted content zero or more <li>, <script> and <template> elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlolistel...
<optgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › optgroup
the html <optgroup> element creates a grouping of options within a <select> element. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content zero or more <option> elements. tag omission the start tag is mandatory. the end tag is optional if this element is immediately followed by another <optgroup> element, or if the parent element has no more content. permitted parents a <select> element. implicit aria role group permitted aria roles no role permitted dom interface htmloptgroupelement note:...
<select>: The HTML Select element - HTML: Hypertext Markup Language
Web › HTML › Element › select
its visualization generally consists of the group name being bolded, and the options being indented. the "hamster" option includes a disabled attribute and therefore can't be selected at all. technical summary content categories flow content, phrasing content, interactive content, listed, labelable, resettable, and submittable form-associated element permitted content zero or more <option> or <optgroup> elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts phrasing content. implicit aria role combobox with no multiple attribute and no size attribute greater than 1, otherwise listbox permitted aria roles menu with no multiple attribute and no size attrib...
<table>: The Table element - HTML: Hypertext Markup Language
Web › HTML › Element › table
of cells containing data. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content permitted content in this order: an optional <caption> element, zero or more <colgroup> elements, an optional <thead> element, either one of the following: zero or more <tbody> elements one or more <tr> elements an optional <tfoot> element tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content impl...
<tbody>: The Table Body element - HTML: Hypertext Markup Language
Web › HTML › Element › tbody
ribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. the <tbody> element, along with its cousins <thead> and <tfoot>, provide useful semantic information that can be used when rendering for either screen or printer as well as for accessibility purposes. content categories none. permitted content zero or more <tr> elements. tag omission the <tbody> element is not a required child element for a parent <table> element to graphically render. however, it must not be present, if its parent <table> element has a <tr> element as a child. permitted parents within the required parent <table> element, the <tbody> element can be added after a <caption>, <colgroup>, and a <thead> e...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
Web › HTML › Element › tfoot
the html <tfoot> element defines a set of rows summarizing the columns of the table. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content zero or more <tr> elements. tag omission the start tag is mandatory. the end tag may be omitted if there is no more content in the parent <table> element. permitted parents a <table> element. the <tfoot> must appear after any <caption>, <colgroup>, <thead>, <tbody>, or <tr> element. note that this is the requirement as of html5. html 4 the <tfoot> element cannot be placed after any <tbody> a...
<thead>: The Table Head element - HTML: Hypertext Markup Language
Web › HTML › Element › thead
the html <thead> element defines a set of rows defining the head of the columns of the table. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories none. permitted content zero or more <tr> elements. tag omission the start tag is mandatory. the end tag may be omitted if the <thead> element is immediately followed by a <tbody> or <tfoot> element. permitted parents a <table> element. the <thead> must appear after any <caption> or <colgroup> element, even implicitly defined, but before any <tbody>, <tfoot> and <tr> element. implicit aria role row...
<tr>: The Table Row element - HTML: Hypertext Markup Language
Web › HTML › Element › tr
with a somewhat different background color. justify the balances finally, since it's standard practice to right-justify currency values in tables, let's do that here. tbody > tr > td:last-of-type { text-align:right; } this just sets the css text-align property for the last <td> in each body row to "right". technical summary content categories none permitted content zero or more <td> and/or <th> elements; script-supporting elements (<script> and <template>) are also allowed tag omission start tag is mandatory. end tag may be omitted if the <tr> element is immediately followed by a <tr> element, or if the row is the last element in its parent table group (<thead>, <tbody> or <tfoot>) element permitted parents <table> (only if the table has ...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ul
d list. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. content categories flow content, and if the <ul> element's children include at least one <li> element, palpable content. permitted content zero or more <li>, <script> and <template> elements. tag omission none, both the starting and ending tag are mandatory. permitted parents any element that accepts flow content. implicit aria role list permitted aria roles directory, group, listbox, menu, menubar, none, presentation, radiogroup, tablist, toolbar, tree dom interface htmlulistel...
<video>: The Video Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › video
1.2 explanations understanding success criterion 1.2.1 | w3c understanding wcag 2.0 understanding success criterion 1.2.2 | w3c understanding wcag 2.0 technical summary content categories flow content, phrasing content, embedded content. if it has a controls attribute: interactive content and palpable content. permitted content if the element has a src attribute: zero or more <track> elements, followed by transparent content that contains no media elements–that is no <audio> or <video> else: zero or more <source> elements, followed by zero or more <track> elements, followed by transparent content that contains no media elements–that is no <audio> or <video>. tag omission none, both the starting and ending tag are mandatory. pe...
<wbr> - HTML: Hypertext Markup Language
Web › HTML › Element › wbr
ty element; it must have a start tag, but must not have an end tag. permitted parents any element that accepts phrasing content. implicit aria role no corresponding role permitted aria roles any dom interface htmlelement attributes this element only includes the global attributes. notes on utf-8 encoded pages, <wbr> behaves like the u+200b zero-width space code point. in particular, it behaves like a unicode bidi bn code point, meaning it has no effect on bidi-ordering: <div dir=rtl>123,<wbr>456</div> displays, when not broken on two lines, 123,456 and not 456,123. for the same reason, the <wbr> element does not introduce a hyphen at the line break point. to make a hyphen appear only at the end of a line, use the soft hyphen char...
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
wsing context, embedding another html page into the current one. <object> the html <object> element represents an external resource, which can be treated as an image, a nested browsing context, or a resource to be handled by a plugin. <param> the html <param> element defines parameters for an <object> element. <picture> the html <picture> element contains zero or more <source> elements and one <img> element to offer alternative versions of an image for different display/device scenarios. <source> the html <source> element specifies multiple media resources for the <picture>, the <audio> element, or the <video> element. scripting in order to create dynamic content and web applications, html supports the use of scripting languages,...
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
<p> element represents a paragraph. 174 <param>: the object parameter element element, html, html embedded content, reference, web the html <param> element defines parameters for an <object> element. 175 <picture>: the picture element element, graphics, html, html embedded content, images, reference, web, webp, picture the html <picture> element contains zero or more <source> elements and one <img> element to offer alternative versions of an image for different display/device scenarios. 176 <plaintext>: the plain text element (deprecated) element, html, obsolete, plain text, reference, web, plaintext the html plaintext element (<plaintext>) renders everything following the start tag as raw text, ignoring any following html. ...
Access-Control-Expose-Headers - HTTP
d pragma if you want clients to be able to access other headers, you have to list them using the access-control-expose-headers header. header type response header forbidden header name no syntax access-control-expose-headers: <header-name>, <header-name>, ... access-control-expose-headers: * directives <header-name> a list of exposed headers consisting of zero or more header names other than the cors-safelisted request headers that the resource might use and can be exposed. * (wildcard) the value "*" only counts as a special wildcard value for requests without credentials (requests without http cookies or http authentication information). in requests with credentials, it is treated as the literal header name "*" without special semantics. note that ...
Age - HTTP
Web › HTTP › Headers › Age
if it is age: 0, it was probably just fetched from the origin server; otherwise it is usually calculated as a difference between the proxy's current date and the date general header included in the http response. header type response header forbidden header name no syntax age: <delta-seconds> directives <delta-seconds> a non-negative integer, representing time in seconds the object has been in a proxy cache. ...
Index - HTTP
Web › HTTP › Headers › Index
nt is willing to accept. (you could informally call it accept-transfer-encoding, which would be more intuitive). 105 timing-allow-origin cors, http, reference, timing-allow-origin, header the timing-allow-origin response header specifies origins that are allowed to see values of attributes retrieved via features of the resource timing api, which would otherwise be reported as zero due to cross-origin restrictions. 106 tk dnt, http, reference, response, header, tracking the tk response header indicates the tracking status that applied to the corresponding request. 107 trailer http, reference, header the trailer response header allows the sender to include additional fields at the end of chunked messages in order to supply metadata t...
Set-Cookie2 - HTTP
se header forbidden header name no syntax set-cookie2: <cookie-name>=<cookie-value> set-cookie2: <cookie-name>=<cookie-value>; comment=<value> set-cookie2: <cookie-name>=<cookie-value>; commenturl=<http-url> set-cookie2: <cookie-name>=<cookie-value>; discard set-cookie2: <cookie-name>=<cookie-value>; domain=<domain-value> set-cookie2: <cookie-name>=<cookie-value>; max-age=<non-zero-digit> set-cookie2: <cookie-name>=<cookie-value>; path=<path-value> set-cookie2: <cookie-name>=<cookie-value>; port=<port-number> set-cookie2: <cookie-name>=<cookie-value>; secure set-cookie2: <cookie-name>=<cookie-value>; version=<version-number> // multiple directives are also possible, for example: set-cookie2: <cookie-name>=<cookie-value>; domain=<domain-value>; secure // multiple cookies a...
Timing-Allow-Origin - HTTP
header type response header forbidden header name no syntax timing-allow-origin: * timing-allow-origin: <origin>[, <origin>]* directives * the server may specify "*" as a wildcard, thereby allowing any origin to see timing resources. <origin> specifies a uri that may see the timing resources. ...
Transfer-Encoding - HTTP
nsfer-encoding: gzip, chunked directives chunked data is sent in a series of chunks. the content-length header is omitted in this case and at the beginning of each chunk you need to add the length of the current chunk in hexadecimal format, followed by '\r\n' and then the chunk itself, followed by another '\r\n'. the terminating chunk is a regular chunk, with the exception that its length is zero. it is followed by the trailer, which consists of a (possibly empty) sequence of entity header fields. compress a format using the lempel-ziv-welch (lzw) algorithm. the value name was taken from the unix compress program, which implemented this algorithm. like the compress program, which has disappeared from most unix distributions, this content-encoding is used by almost no browsers today, pa...
User-Agent - HTTP
ype request header forbidden header name no syntax user-agent: <product> / <product-version> <comment> common format for web browsers: user-agent: mozilla/5.0 (<system-information>) <platform> (<platform-details>) <extensions> directives <product> a product identifier — its name or development codename. <product-version> version number of the product. <comment> zero or more comments containing more details; sub-product information, for example. firefox ua string for more on firefox- and gecko-based user agent strings, see the firefox user agent string reference. the ua string of firefox is broken down into 4 components: mozilla/5.0 (platform; rv:geckoversion) gecko/geckotrail firefox/firefoxversion mozilla/5.0 is the general token that says the browse...
HTTP headers - HTTP
Web › HTTP › Headers
al request is made. access-control-request-method used when issuing a preflight request to let the server know which http method will be used when the actual request is made. origin indicates where a fetch originates from. timing-allow-origin specifies origins that are allowed to see values of attributes retrieved via features of the resource timing api, which would otherwise be reported as zero due to cross-origin restrictions. do not track dnt expresses the user's tracking preference. tk indicates the tracking status of the corresponding response. downloads content-disposition indicates if the resource transmitted should be displayed inline (default behavior without the header), or if it should be handled like a download and the browser should present a “save as” dial...
HTTP Index - HTTP
Web › HTTP › Index
nt is willing to accept. (you could informally call it accept-transfer-encoding, which would be more intuitive). 186 timing-allow-origin cors, http, reference, timing-allow-origin, header the timing-allow-origin response header specifies origins that are allowed to see values of attributes retrieved via features of the resource timing api, which would otherwise be reported as zero due to cross-origin restrictions. 187 tk dnt, http, reference, response, header, tracking the tk response header indicates the tracking status that applied to the corresponding request. 188 trailer http, reference, header the trailer response header allows the sender to include additional fields at the end of chunked messages in order to supply metadata t...
JavaScript data types and data structures - JavaScript
ger. beyond this range, integers in javascript are not safe anymore and will be a double-precision floating point approximation of the value. the number type has only one integer with two representations: 0 is represented as both -0 and +0. (0 is an alias for +0.) in the praxis, this has almost no impact. for example, +0 === -0 is true. however, you are able to notice this when you divide by zero: > 42 / +0 infinity > 42 / -0 -infinity although a number often represents only its value, javascript provides binary (bitwise) operators. caution: although bitwise operators can be used to represent several boolean values within a single number using bit masking, this is usually considered a bad practice. javascript offers other means to represent a set of booleans (like an array of boolean...
Concurrency model and the event loop - JavaScript
mmediately after its timer expires): const s = new date().getseconds(); settimeout(function() { // prints out "2", meaning that the callback is not called immediately after 500 milliseconds. console.log("ran after " + (new date().getseconds() - s) + " seconds"); }, 500) while (true) { if (new date().getseconds() - s >= 2) { console.log("good, looped for 2 seconds") break; } } zero delays zero delay doesn't actually mean the call back will fire-off after zero milliseconds. calling settimeout with a delay of 0 (zero) milliseconds doesn't execute the callback function after the given interval. the execution depends on the number of waiting tasks in the queue. in the example below, the message ''this is just a message'' will be written to the console before the message in th...
Details of the object model - JavaScript
t. therefore, this line of code tests to see if name has a useful value for the name property. if it does, it sets this.name to that value. otherwise, it sets this.name to the empty string. this chapter uses this idiom for brevity; however, it can be puzzling at first glance. note: this may not work as expected if the constructor function is called with arguments which convert to false (like 0 (zero) and empty string (""). in this case the default value will be chosen. with these definitions, when you create an instance of an object, you can specify values for the locally defined properties. you can use the following statement to create a new engineer: var jane = new engineer('belau'); jane's properties are now: jane.name == ''; jane.dept == 'engineering'; jane.projects == []; jane.mac...
Keyed collections - JavaScript
no list of current objects stored in the collection. weaksets are not enumerable. the use cases of weakset objects are limited. they will not leak memory, so it can be safe to use dom elements as a key and mark them for tracking purposes, for example. key and value equality of map and set both the key equality of map objects and the value equality of set objects, are based on the "same-value-zero algorithm": equality works like the identity comparison operator ===. -0 and +0 are considered equal. nan is considered equal to itself (contrary to ===). « previousnext » ...
Loops and iteration - JavaScript
for example, the idea "go five steps to the east" could be expressed this way as a loop: for (let step = 0; step < 5; step++) { // runs 5 times, with values of step 0 through 4. console.log('walking east one step'); } there are many different kinds of loops, but they all essentially do the same thing: they repeat an action some number of times. (note that it's possible that number could be zero!) the various loop mechanisms offer different ways to determine the start and end points of the loop. there are various situations that are more easily served by one type of loop over the others. the statements for loops provided in javascript are: for statement do...while statement while statement labeled statement break statement continue statement for...in statement for...of statem...
Assertions - JavaScript
character. for example, /t$/ does not match the "t" in "eater", but does match it in "eat". \b matches a word boundary. this is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. note that a matched word boundary is not included in the match. in other words, the length of a matched word boundary is zero. examples: /\bm/ matches the "m" in "moon". /oo\b/ does not match the "oo" in "moon", because "oo" is followed by "n" which is a word character. /oon\b/ matches the "oon" in "moon", because "oon" is the end of the string, thus not followed by a word character. /\w\b\w/ will never match anything, because a word character can never be followed by both a non-word and a...
Regular expression syntax cheatsheet - JavaScript
character. for example, /t$/ does not match the "t" in "eater", but does match it in "eat". \b matches a word boundary. this is the position where a word character is not followed or preceded by another word-character, such as between a letter and a space. note that a matched word boundary is not included in the match. in other words, the length of a matched word boundary is zero. examples: /\bm/ matches the "m" in "moon". /oo\b/ does not match the "oo" in "moon", because "oo" is followed by "n" which is a word character. /oon\b/ matches the "oon" in "moon", because "oon" is the end of the string, thus not followed by a word character. /\w\b\w/ will never match anything, because a word character can never be followed by both a non-word and a...
Regular expressions - JavaScript
abc". there is no match in the string "grab crab" because while it contains the substring "ab c", it does not contain the exact substring "abc". using special characters when the search for a match requires something more than a direct match, such as finding one or more b's, or finding white space, you can include special characters in the pattern. for example, to match a single "a" followed by zero or more "b"s followed by "c", you'd use the pattern /ab*c/: the * after "b" means "0 or more occurrences of the preceding item." in the string "cbbabbbbcdebc", this pattern will match the substring "abbbbc". the following pages provide lists of the different special characters that fit into each category, along with descriptions and examples. assertions assertions include boundaries, which i...
Working with objects - JavaScript
) and property name are case sensitive. you can define a property by assigning it a value. for example, let's create an object named mycar and give it properties named make, model, and year as follows: var mycar = new object(); mycar.make = 'ford'; mycar.model = 'mustang'; mycar.year = 1969; the above example could also be written using an object initializer, which is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}): var mycar = { make: 'ford', model: 'mustang', year: 1969 }; unassigned properties of an object are undefined (and not null). mycar.color; // undefined properties of javascript objects can also be accessed or set using a bracket notation (for more details see property accessors). obj...
The legacy Iterator protocol - JavaScript
oops and the iterator protocol. the deprecated firefox-only iterator protocol firefox, prior to version 26 implemented another iterator protocol that is similar to the standard es2015 iterator protocol. an object is an legacy iterator when it implements a next() method with the following semantics, and throws stopiteration at the end of iteration. property value next a zero arguments function that returns an value. difference between legacy and es2015 iterator protocols the value was returned directly as a return value of calls to next, instead of the value property of a placeholder object iteration termination was expressed by throwing a stopiteration object. simple example with the old protocol function makeiterator(array){ var nextindex = 0; ...
SyntaxError: illegal character - JavaScript
var foo = 'bar';​<200b> ...
The arguments object - JavaScript
eractive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. description note: if you're writing es6 compatible code, then rest parameters should be preferred. note: “array-like” means that arguments has a length property and properties indexed from zero, but it doesn't have array's built-in methods like foreach() or map(). see §description for details. the arguments object is a local variable available within all non-arrow functions. you can refer to a function's arguments inside that function by using its arguments object. it has entries for each argument the function was called with, with the first entry's index at 0. for example, if a fun...
getter - JavaScript
plished with the use of a getter. it is not possible to simultaneously have a getter bound to a property and have that property actually hold a value, although it is possible to use a getter and a setter in conjunction to create a type of pseudo-property. note the following when working with the get syntax: it can have an identifier which is either a number or a string; it must have exactly zero parameters (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another get or with a data entry for the same property ({ get x() { }, get x() { } } and { x: ..., get x() { } } are forbidden). examples defining a getter on new objects in object initializers this will c...
setter - JavaScript
onjunction with getters to create a type of pseudo-property. it is not possible to simultaneously have a setter on a property that holds an actual value. note the following when working with the set syntax: it can have an identifier which is either a number or a string; it must have exactly one parameter (see incompatible es5 change: literal getter and setter functions must now have exactly zero or one arguments for more information); it must not appear in an object literal with another set or with a data entry for the same property. ( { set x(v) { }, set x(v) { } } and { x: ..., set x(v) { } } are forbidden ) examples defining a setter on new objects in object initializers the following example define a pseudo-property current of object language. when current is assigned a value...
Array.prototype.filter() - JavaScript
let arr = [ { id: 15 }, { id: -1 }, { id: 0 }, { id: 3 }, { id: 12.2 }, { }, { id: null }, { id: nan }, { id: 'undefined' } ] let invalidentries = 0 function filterbyid(item) { if (number.isfinite(item.id) && item.id !== 0) { return true } invalidentries++ return false; } let arrbyid = arr.filter(filterbyid) console.log('filtered array\n', arrbyid) ...
Array.prototype.includes() - JavaScript
e values of fromindex, or at arr.length + fromindex for negative values of fromindex (using the absolute value of fromindex as the number of elements from the end of the array at which to start the search). defaults to 0. return value a boolean which is true if the value valuetofind is found within the array (or the part of the array indicated by the index fromindex, if specified). values of zero are all considered to be equal, regardless of sign. (that is, -0 is considered to be equal to both 0 and +0), but false is not considered to be the same as 0. note: technically speaking, includes() uses the samevaluezero algorithm to determine whether the given element is found. examples [1, 2, 3].includes(2) // true [1, 2, 3].includes(4) // false [1, 2, 3].includes(3, 3) // fals...
Array.prototype.pop() - JavaScript
x arrname.pop() return value the removed element from the array; undefined if the array is empty. description the pop method removes the last element from an array and returns that value to the caller. pop is intentionally generic; this method can be called or applied to objects resembling arrays. objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. if you call pop() on an empty array, it returns undefined. array.prototype.shift() has similar behavior to pop, but applied to the first element in an array. examples removing the last element of an array the following code creates the myfish array containing four elements, then removes its last element. var myfish = ['ange...
Array.prototype.reverse() - JavaScript
a.reverse() return value the reversed array. description the reverse method transposes the elements of the calling array object in place, mutating the array, and returning a reference to the array. reverse is intentionally generic; this method can be called or applied to objects resembling arrays. objects which do not contain a length property reflecting the last in a series of consecutive, zero-based numerical properties may not behave in any meaningful manner. examples reversing the elements in an array the following example creates an array a, containing three elements, then reverses the array. the call to reverse() returns a reference to the reversed array a. const a = [1, 2, 3]; console.log(a); // [1, 2, 3] a.reverse(); console.log(a); // [3, 2, 1] reversing the elements i...
Array.prototype.slice() - JavaScript
cluded) where start and end represent the index of items in that array. the original array will not be modified. the source for this interactive demo is stored in a github repository. if you'd like to contribute to the interactive demo project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax arr.slice([start[, end]]) parameters start optional zero-based index at which to start extraction. a negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. if start is undefined, slice starts from the index 0. if start is greater than the index range of the sequence, an empty array is returned. end optional zero-based index before which to end extraction. slice extra...
Array.prototype.sort() - JavaScript
expressions with even shorter syntax. let numbers = [4, 2, 5, 1, 3]; numbers.sort((a, b) => a - b); console.log(numbers); // [1, 2, 3, 4, 5] objects can be sorted, given the value of one of their properties. ...
Array.prototype.toLocaleString() - JavaScript
// 2. let len be ? tolength(? get(a, "length")). var len = a.length >>> 0; // 3. let separator be the string value for the // list-separator string appropriate for the // host environment's current locale (this is // derived in an implementation-defined way). // note: in this case, we will use a comma var separator = ','; // 4. if len is zero, return the empty string. if (len === 0) { return ''; } // 5. let firstelement be ? get(a, "0"). var firstelement = a[0]; // 6. if firstelement is undefined or null, then // a.let r be the empty string. // 7. else, // a. let r be ? // tostring(? // invoke( // firstelement, // "tolocalestring...
Array.prototype.unshift() - JavaScript
of the arr. return value the new length property of the object upon which the method was called. description the unshift method inserts the given values to the beginning of an array-like object. unshift is intentionally generic. this method can be called or applied to objects resembling arrays. objects which do not contain a length property—reflecting the last in a series of consecutive, zero-based numerical properties—may not behave in any meaningful manner. please note that, if multiple elements are passed as parameters, they're inserted in chunk at the beginning of the object, in the exact same order they were passed as parameters. hence, calling unshift with n arguments once, or calling it n times with 1 argument (with a loop, for example), don't yield the same results. see ex...
BigInt.asUintN() - JavaScript
r the integer size. bigint the integer to clamp to fit into the supplied bits. returns the value of bigint modulo 2width as an unsigned integer. examples staying in 64-bit ranges the bigint.asuintn() method can be useful to stay in the range of 64-bit arithmetic. const max = 2n ** 64n - 1n; bigint.asuintn(64, max); // ↪ 18446744073709551615n bigint.asuintn(64, max + 1n); // ↪ 0n // zero because of overflow specifications specification ecmascript (ecma-262)the definition of 'bigint.asuintn()' in that specification. ...
BigInt.prototype.toString() - JavaScript
he sign is preserved. this is the case even if the radix is 2; the string returned is the positive binary representation of the bigintobj preceded by a - sign, not the two's complement of the bigintobj. examples using tostring 17n.tostring(); // '17' 66n.tostring(2); // '1000010' 254n.tostring(16); // 'fe' -10n.tostring(2); // -1010' -0xffn.tostring(2); // '-11111111' negative-zero bigint there is no negative-zero bigint as there are no negative zeros in integers. -0.0 is an ieee floating-point concept that only appears in the javascript number type. (-0n).tostring(); // '0' bigint(-0).tostring(); // '0' specifications specification ecmascript (ecma-262)the definition of 'bigint.prototype.tostring()' in that specification. ...
BigInt - JavaScript
, a bigint will give "bigint": typeof 1n === 'bigint' // true typeof bigint('1') === 'bigint' // true when wrapped in an object, a bigint will be considered as a normal "object" type: typeof object(1n) === 'object' // true operators the following operators may be used with bigints (or object-wrapped bigints): +, *, -, **, %. bitwise operators are supported as well, except >>> (zero-fill right shift) as all bigints are signed. also unsupported is the unary operator (+), in order to not break asm.js. const previousmaxsafe = bigint(number.max_safe_integer) // ↪ 9007199254740991n const maxplusone = previousmaxsafe + 1n // ↪ 9007199254740992n const thefuture = previousmaxsafe + 2n // ↪ 9007199254740993n, this works now! const multi = previousmaxsafe * 2n // ↪ 180143...
BigInt64Array() constructor - JavaScript
andard array index syntax (that is, using bracket notation). syntax new bigint64array(); new bigint64array(length); new bigint64array(typedarray); new bigint64array(object); new bigint64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
BigUint64Array() constructor - JavaScript
d array index syntax (that is, using bracket notation). syntax new biguint64array(); new biguint64array(length); new biguint64array(typedarray); new biguint64array(object); new biguint64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Boolean() constructor - JavaScript
e example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax new boolean([value]) parameters value optional the initial value of the boolean object. ...
Boolean - JavaScript
s boolean.prototype.tostring() returns a string of either true or false depending upon the value of the object. overrides the object.prototype.tostring() method. boolean.prototype.valueof() returns the primitive value of the boolean object. overrides the object.prototype.valueof() method. ...
DataView.prototype.setBigUint64() - JavaScript
b.com/mdn/interactive-examples and send us a pull request. syntax dataview.setbiguint64(byteoffset, value [, littleendian]) parameters byteoffset the offset, in bytes, from the start of the view to store the data from. value the value to set as a bigint. the highest possible value that fits in an unsigned 64-bit integer is 2n ** 64n - 1n (18446744073709551615n). upon overflow, it will be zero (0n). littleendian optional indicates whether the 64-bit int is stored in little- or big-endian format. if false or undefined, a big-endian value is written. return value undefined. errors thrown rangeerror thrown if the byteoffset is set such that it would store beyond the end of the view. examples using the setbiguint64 method var buffer = new arraybuffer(8); var dataview = new da...
DataView - JavaScript
eds max_safe_integer. precision may be lost'); return combined; } alternatively, if you need full 64-bit range, you can create a bigint. further, although native bigints are much faster than user-land library equivalents, bigints will always be much slower than 32-bit integers in javascript due to the nature of their variable size. ...
Date.prototype.getMonth() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getmonth() return value an integer number, between 0 and 11, representing the month in the given date according to local time. 0 corresponds to january, 1 to february, and so on. ...
Date.prototype.getTime() - JavaScript
ed new date().gettime(); // 1519129853500 // 1519129858900 // 1519129864400 // ... in firefox, you can also enable privacy.resistfingerprinting, the precision will be 100ms or the value of privacy.resistfingerprinting.reducetimerprecision.microseconds, whichever is larger. examples using gettime() for copying dates constructing a date object with the identical time value. // since month is zero based, birthday will be january 10, 1995 var birthday = new date(1994, 12, 10); var copy = new date(); copy.settime(birthday.gettime()); measuring execution time subtracting two subsequent gettime() calls on newly generated date objects, give the time span between these two calls. this can be used to calculate the executing time of some operations. see also date.now() to prevent instantiating ...
Date.prototype.getUTCMonth() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax dateobj.getutcmonth() return value an integer number, between 0 and 11, corresponding to the month of the given date according to universal time. 0 for january, 1 for february, 2 for march, and so on. ...
Date.prototype.setMonth() - JavaScript
so, 0 represents january, 11 represents december, -1 represents december of the previous year, and 12 represents january of the following year. dayvalue optional. an integer from 1 to 31, representing the day of the month. ...
Date.prototype.toISOString() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
Date.prototype.toString() - JavaScript
sh month name, e.g. "sep" space date: 2 digit day in month, e.g. "01" space year: 4 digit year, e.g. "2018" space hour: 2 digit hour of day, e.g. "14" colon minute: 2 digit minute of hour, e.g. "53" colon second: 2 digit second of minute, e.g. "26" space the string "gmt" timezone offset sign, either: "+" for positive offsets (0 or greater) "-" for negative offsets (less than zero) two digit hour offset, e.g. "14" two digit minute offset, e.g. "00" optionally, a timezone name consisting of: space left bracket, i.e. "(" an implementation dependent string representation of the timezone, which might be an abbreviation or full name (there is no standard for names or abbreviations of timezones), e.g. "line islands time" or "lint" right bracket, i.e. ")" ...
Float32Array() constructor - JavaScript
index syntax (that is, using bracket notation). syntax new float32array(); // new in es2017 new float32array(length); new float32array(typedarray); new float32array(object); new float32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Float64Array() constructor - JavaScript
index syntax (that is, using bracket notation). syntax new float64array(); // new in es2017 new float64array(length); new float64array(typedarray); new float64array(object); new float64array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Function.prototype.bind() - JavaScript
artial implementation creates functions that have a prototype property. (proper bound functions have none.) the partial implementation creates bound functions whose length property does not agree with that mandated by ecma-262: it creates functions with length of 0. a full implementation—depending on the length of the target function and the number of pre-specified arguments—may return a non-zero length. the partial implementation creates bound functions whose name property is not derived from the original function name. according to ecma-262, name of the returned bound function should be "bound " + name of target function (note the space character). if you choose to use this partial implementation, you must not rely on those cases where behavior deviates from ecma-262, 5th edition! th...
Int16Array() constructor - JavaScript
dard array index syntax (that is, using bracket notation). syntax new int16array(); // new in es2017 new int16array(length); new int16array(typedarray); new int16array(object); new int16array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Int32Array() constructor - JavaScript
dard array index syntax (that is, using bracket notation). syntax new int32array(); // new in es2017 new int32array(length); new int32array(typedarray); new int32array(object); new int32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Int8Array() constructor - JavaScript
standard array index syntax (that is, using bracket notation). syntax new int8array(); // new in es2017 new int8array(length); new int8array(typedarray); new int8array(object); new int8array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Intl.Collator() constructor - JavaScript
calematcher the locale matching algorithm to use. possible values are "lookup" and "best fit"; the default is "best fit". for information about this option, see the intl page. usage whether the comparison is for sorting or for searching for matching strings. possible values are "sort" and "search"; the default is "sort". sensitivity which differences in the strings should lead to non-zero result values. possible values are: "base": only strings that differ in base letters compare as unequal. examples: a ≠ b, a = á, a = a. "accent": only strings that differ in base letters or accents and other diacritic marks compare as unequal. examples: a ≠ b, a ≠ á, a = a. "case": only strings that differ in base letters or case compare as unequal. examples: a ≠ b, a = á,...
Intl.PluralRules.prototype.resolvedOptions() - JavaScript
ect has the following properties: locale the bcp 47 language tag for the locale actually used. if any unicode extension values were requested in the input bcp 47 language tag that led to this locale, the key-value pairs that were requested and are supported for this locale are included in locale. pluralcategories an array of plural categories used by the given locale, seleced from the list "zero", "one", "two", "few", "many" and "other". type the type used (cardinal or ordinal). only one of the following two groups of properties is included: minimumintegerdigits minimumfractiondigits maximumfractiondigits the values provided for these properties in the options argument or filled in as defaults. these properties are present only if neither minimumsignificantdigits nor maximumsig...
Intl.PluralRules - JavaScript
cale-aware formatting. examples using locales this example shows some of the variations in localized plural rules. in order to get the format of the language used in the user interface of your application, make sure to specify that language (and possibly some fallback languages) using the locales argument: // arabic has different plural rules new intl.pluralrules('ar-eg').select(0); // → 'zero' new intl.pluralrules('ar-eg').select(1); // → 'one' new intl.pluralrules('ar-eg').select(2); // → 'two' new intl.pluralrules('ar-eg').select(6); // → 'few' new intl.pluralrules('ar-eg').select(18); // → 'many' specifications specification ecmascript internationalization api (ecma-402)the definition of 'intl.pluralrules' in that specification. ...
JSON - JavaScript
operties, it has no interesting functionality of its own. description javascript and json differences json is a syntax for serializing objects, arrays, numbers, strings, booleans, and null. it is based upon javascript syntax but is distinct from it: some javascript is not json. objects and arrays property names must be double-quoted strings; trailing commas are forbidden. numbers leading zeros are prohibited. a decimal point must be followed by at least one digit. nan and infinity are unsupported. any json text is a valid javascript expression... ...but only in javascript engines that have implemented the proposal to make all json text valid ecma-262. in engines that haven't implemented the proposal, u+2028 line separator and u+2029 paragraph separator are allowed in string literals...
Math.ceil() - JavaScript
decimal adjustment // closure (function() { /** * decimal adjustment of a number. * * @param {string} type the type of adjustment. * @param {number} value the number. * @param {integer} exp the exponent (the 10 logarithm of the adjustment base). * @returns {number} the adjusted value. */ function decimaladjust(type, value, exp) { // if the exp is undefined or zero... if (typeof exp === 'undefined' || +exp === 0) { return math[type](value); } value = +value; exp = +exp; // if the value is not a number or the exp is not an integer... if (isnan(value) || !(typeof exp === 'number' && exp % 1 === 0)) { return nan; } // shift value = value.tostring().split('e'); value = math[type](+(value[0] + 'e' + (value[1] ?
Math.floor() - JavaScript
or(-45.05); // -46 math.floor(-45.95); // -46 decimal adjustment /** * decimal adjustment of a number. * * @param {string} type the type of adjustment. * @param {number} value the number. * @param {integer} exp the exponent (the 10 logarithm of the adjustment base). * @returns {number} the adjusted value. */ function decimaladjust(type, value, exp) { // if the exp is undefined or zero... if (typeof exp === 'undefined' || +exp === 0) { return math[type](value); } value = +value; exp = +exp; // if the value is not a number or the exp is not an integer... if (isnan(value) || !(typeof exp === 'number' && exp % 1 === 0)) { return nan; } // shift value = value.tostring().split('e'); value = math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -ex...
Math.fround() - JavaScript
so possible: if (!math.fround) math.fround = function(arg) { arg = number(arg); // return early for ±0 and nan. if (!arg) return arg; var sign = arg < 0 ? -1 : 1; if (sign < 0) arg = -arg; // compute the exponent (8 bits, signed). var exp = math.floor(math.log(arg) / math.ln2); var powexp = math.pow(2, math.max(-126, math.min(exp, 127))); // handle subnormals: leading digit is zero if exponent bits are all zero. var leading = exp < -127 ? 0 : 1; // compute 23 bits of mantissa, inverted to round toward zero. var mantissa = math.round((leading - arg / powexp) * 0x800000); if (mantissa <= -0x800000) return sign * infinity; return sign * powexp * (leading - mantissa / 0x800000); }; examples using math.fround() the number 1.5 can be precisely represented in the bina...
Math.max() - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.max([value1[, value2[, ...]]]) parameters value1, value2, ... numbers. return value the largest of the given numbers. if at least one of the arguments cannot be converted to a number, nan is returned. description because math is not a constructor, max() is a static method of math (you always use it as math.max(), rather than as a method of an instanced math object). ...
Math.min() - JavaScript
ber passed into it, or nan if any parameter isn't a number and can't be converted into one. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.min([value1[, value2[, ...]]]) parameters value1, value2, ... zero or more numbers among which the lowest value will be selected and returned. return value the smallest of the given numbers. if any one or more of the parameters cannot be converted into a number, nan is returned. the result is infinity if no parameters are provided. description because min() is a static method of math, you always use it as math.min(), rather than as a method of a math object...
Math.round() - JavaScript
rgument is rounded to the integer with the next higher absolute value. if it is less than 0.5, the argument is rounded to the integer with the lower absolute value. if the fractional portion is exactly 0.5, the argument is rounded to the next integer in the direction of +∞. note that this differs from many languages' round() functions, which often round this case to the next integer away from zero, instead giving a different result in the case of negative numbers with a fractional part of exactly 0.5. because round() is a static method of math, you always use it as math.round(), rather than as a method of a math object you created (math has no constructor). examples using round math.round( 20.49); // 20 math.round( 20.5 ); // 21 math.round( 42 ); // 42 math.round(-20.5 ); // -20 m...
Math.sign() - JavaScript
es project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax math.sign(x) parameters x a number. if this argument is not a number, it is implicitly converted to one. return value a number representing the sign of the given argument: if the argument is positive, returns 1. if the argument is negative, returns -1. if the argument is positive zero, returns 0. if the argument is negative zero, returns -0. otherwise, nan is returned. description because sign() is a static method of math, you always use it as math.sign(), rather than as a method of a math object you created (math is not a constructor). polyfill if (!math.sign) { math.sign = function(x) { // if x is nan, the result is nan. // if x is -0, the result is -0. ...
Number.MAX_SAFE_INTEGER - JavaScript
ject you created. polyfill if (!number.max_safe_integer) { number.max_safe_integer = 9007199254740991; // math.pow(2, 53) - 1; } examples return value of max_safe_integer number.max_safe_integer; // 9007199254740991 numbers higher than safe integer this returns 2 because in floating points, the value is actually the decimal trailing "1" except for in subnormal precision cases such as zero. number.max_safe_integer * number.epsilon; // 2 specifications specification ecmascript (ecma-262)the definition of 'number.max_safe_integer' in that specification. ...
Number.NEGATIVE_INFINITY - JavaScript
he negative value of the global object's infinity property. this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by negative_infinity is negative_infinity. any negative value, including negative_infinity, multiplied by negative_infinity is positive_infinity. any positive value divided by negative_infinity is negative zero. any negative value divided by negative_infinity is positive zero. zero multiplied by negative_infinity is nan. nan multiplied by negative_infinity is nan. negative_infinity, divided by any negative value except negative_infinity, is positive_infinity. negative_infinity, divided by any positive value except positive_infinity, is negative_infinity. negative_infinity, divided by either negati...
Number.POSITIVE_INFINITY - JavaScript
ame as the value of the global object's infinity property. this value behaves slightly differently than mathematical infinity: any positive value, including positive_infinity, multiplied by positive_infinity is positive_infinity. any negative value, including negative_infinity, multiplied by positive_infinity is negative_infinity. any positive number divided by positive_infinity is positive zero. any negative number divided by positive_infinity is negative zero. zero multiplied by positive_infinity is nan. nan multiplied by positive_infinity is nan. positive_infinity, divided by any negative value except negative_infinity, is negative_infinity. positive_infinity, divided by any positive value except positive_infinity, is positive_infinity. positive_infinity, divided by either negat...
Number.isSafeInteger() - JavaScript
her integer to fit the ieee-754 representation. for example, 253 - 1 is a safe integer: it can be exactly represented, and no other integer rounds to it under any ieee-754 rounding mode. in contrast, 253 is not a safe integer: it can be exactly represented in ieee-754, but the integer 253 + 1 can't be directly represented in ieee-754 but instead rounds to 253 under round-to-nearest and round-to-zero rounding. the safe integers consist of all integers from -(253 - 1) inclusive to 253 - 1 inclusive (± 9007199254740991 or ± 9,007,199,254,740,991). handling values larger or smaller than ~9 quadrillion with full precision requires using an arbitrary precision arithmetic library. see what every programmer needs to know about floating point arithmetic for more information on floating point repre...
Number - JavaScript
es number.epsilon the smallest interval between two representable numbers. number.max_safe_integer the maximum safe integer in javascript (253 - 1). number.max_value the largest positive representable number. number.min_safe_integer the minimum safe integer in javascript (-(253 - 1)). number.min_value the smallest positive representable number—that is, the positive number closest to zero (without actually being zero). number.nan special "not a number" value. number.negative_infinity special value representing negative infinity. returned on overflow. number.positive_infinity special value representing infinity. returned on overflow. number.prototype allows the addition of properties to the number object. static methods number.isnan() determine whether the passed valu...
Object.is() - JavaScript
value. description object.is() determines whether two values are the same value. two values are the same if one of the following holds: both undefined both null both true or both false both strings of the same length with the same characters in the same order both the same object (means both object have same reference) both numbers and both +0 both -0 both nan or both non-zero and both not nan and both have the same value this is not the same as being equal according to the == operator. the == operator applies various coercions to both sides (if they are not the same type) before testing for equality (resulting in such behavior as "" == false being true), but object.is doesn't coerce either value. this is also not the same as being equal according to the === op...
Promise - JavaScript
). the alternative is to throw a special value (in this case "-999", but a custom error type would be more appropriate). this code can be run under nodejs. comprehension is enhanced by seeing the errors actually occur. to force more errors, change the threshold values. ...
Reflect.get() - JavaScript
, it can be an object that inherits from target. return value the value of the property. exceptions a typeerror, if target is not an object. description the reflect.get method allows you to get a property on an object. it is like the property accessor syntax as a function. ...
RegExpInstance.lastIndex - JavaScript
ndex is set to the next position following the most recent match. examples using lastindex consider the following sequence of statements: var re = /(hi)?/g; matches the empty string. console.log(re.exec('hi')); console.log(re.lastindex); returns ["hi", "hi"] with lastindex equal to 2. console.log(re.exec('hi')); console.log(re.lastindex); returns ["", undefined], an empty array whose zeroth element is the match string. in this case, the empty string because lastindex was 2 (and still is 2) and hi has length 2. specifications specification ecmascript (ecma-262)the definition of 'regexp.lastindex' in that specification. ...
Set.prototype.has() - JavaScript
to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax myset.has(value); parameters value the value to test for presence in the set object. return value returns true if an element with the specified value exists in the set object; otherwise false. note: technically speaking, has() uses the samevaluezero algorithm to determine whether the given element is found. examples using the has method var myset = new set(); myset.add('foo'); myset.has('foo'); // returns true myset.has('bar'); // returns false var set1 = new set(); var obj1 = {'key1': 1}; set1.add(obj1); set1.has(obj1); // returns true set1.has({'key1': 1}); // returns false because they are different object references set1.
SharedArrayBuffer.prototype.slice() - JavaScript
rom the beginning. this method has the same algorithm as array.prototype.slice(). the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax sab.slice() sab.slice(begin) sab.slice(begin, end) parameters begin optional zero-based index at which to begin extraction. a negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. if begin is undefined, slice begins from index 0. end optional zero-based index before which to end extraction. slice extracts up to but not including end. for example, slice(1,4) extracts the second element throu...
String.prototype.localeCompare() - JavaScript
its compare property. examples using localecompare() // the letter "a" is before "c" yielding a negative value 'a'.localecompare('c'); // -2 or -1 (or some other negative value) // alphabetically the word "check" comes after "against" yielding a positive value 'check'.localecompare('against'); // 2 or 1 (or some other positive value) // "a" and "a" are equivalent yielding a neutral value of zero 'a'.localecompare('a'); // 0 sort an array localecompare() enables case-insensitive sorting for an array. let items = ['réservé', 'premier', 'cliché', 'communiqué', 'café', 'adieu']; items.sort( (a, b) => a.localecompare(b, 'fr', {ignorepunctuation: true})); // ['adieu', 'café', 'cliché', 'communiqué', 'premier', 'réservé'] check browser support for extended arguments the locales...
String.prototype.match() - JavaScript
found = str.match(re); console.log(found); // logs [ 'see chapter 3.4.5.1', // 'chapter 3.4.5.1', // '.1', // index: 22, // input: 'for more information, see chapter 3.4.5.1' ] // 'see chapter 3.4.5.1' is the whole match. // 'chapter 3.4.5.1' was captured by '(chapter \d+(\.\d)*)'. // '.1' was the last value captured by '(\.\d)'. // the 'index' property (22) is the zero-based index of the whole match. // the 'input' property is the original string that was parsed. using global and ignore case flags with match() the following example demonstrates the use of the global and ignore case flags with match(). all letters a through e and a through e are returned, each its own element in the array. const str = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'; co...
String.prototype.slice() - JavaScript
cts a section of a string and returns it as a new string, without modifying the original string. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax str.slice(beginindex[, endindex]) parameters beginindex the zero-based index at which to begin extraction. if negative, it is treated as str.length + beginindex. (for example, if beginindex is -3 it is treated as str.length - 3.) if beginindex is greater than or equal to str.length, slice() returns an empty string. endindex optional the zero-based index before which to end extraction. the character at this index will not be included. if endindex is o...
TypedArray.prototype.slice() - JavaScript
has the same algorithm as array.prototype.slice(). typedarray is one of the typed array types here. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax typedarray.slice([begin[, end]]) parameters begin optional zero-based index at which to begin extraction. a negative index can be used, indicating an offset from the end of the sequence. slice(-2) extracts the last two elements in the sequence. if begin is undefined, slice begins from index 0. end optional zero-based index before which to end extraction. slice extracts up to but not including end. for example, slice(1,4) extracts the second element throu...
TypedArray.prototype.subarray() - JavaScript
nd optional element to end at. the offset is exclusive. if not specified, all elements from the one specified by begin to the end of the array are included in the new view. return value a new typedarray object. description the range specified by begin and end is clamped to the valid index range for the current array; if the computed length of the new array would be negative, it's clamped to zero. if either begin or end is negative, it refers to an index from the end of the array instead of from the beginning. also note that this is creating a new view on the existing buffer; changes to the new object's contents will impact the original object and vice versa. examples using the subarray method var buffer = new arraybuffer(8); var uint8 = new uint8array(buffer); uint8.set([1,2,3]); co...
TypedArray - JavaScript
ir constructors: new typedarray(); new typedarray(length); new typedarray(typedarray); new typedarray(object); new typedarray(buffer [, byteoffset [, length]]); where typedarray is a constructor for one of the concrete types. parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Uint16Array() constructor - JavaScript
16-bit unsigned integers in the platform byte order. syntax new uint16array(); // new in es2017 new uint16array(length); new uint16array(typedarray); new uint16array(object); new uint16array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Uint32Array() constructor - JavaScript
array index syntax (that is, using bracket notation). syntax new uint32array(); // new in es2017 new uint32array(length); new uint32array(typedarray); new uint32array(object); new uint32array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Uint8Array() constructor - JavaScript
dard array index syntax (that is, using bracket notation). syntax new uint8array(); // new in es2017 new uint8array(length); new uint8array(typedarray); new uint8array(object); new uint8array(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
Uint8ClampedArray() constructor - JavaScript
sing bracket notation). syntax new uint8clampedarray(); // new in es2017 new uint8clampedarray(length); new uint8clampedarray(typedarray); new uint8clampedarray(object); new uint8clampedarray(buffer [, byteoffset [, length]]); parameters length when called with a length argument, an internal array buffer is created in memory, of size length multiplied by bytes_per_element bytes, containing zeros. typedarray when called with a typedarray argument, which can be an object of any of the typed array types (such as int32array), the typedarray gets copied into a new typed array. each value in typedarray is converted to the corresponding type of the constructor before being copied into the new array. the length of the new typed array will be same as the length of the typedarray argument. obj...
parseInt() - JavaScript
ive, and - for negative (since ecmascript 1). it is done as an initial step in the parsing after whitespace is removed. if no signs are found, the algorithm moves to the following step; otherwise, it removes the sign and runs the number-parsing on the rest of the string. if radix is undefined, 0, or unspecified, javascript assumes the following: if the input string begins with "0x" or "0x" (a zero, followed by lowercase or uppercase x), radix is assumed to be 16 and the rest of the string is parsed as a hexidecimal number. if the input string begins with "0" (a zero), radix is assumed to be 8 (octal) or 10 (decimal). exactly which radix is chosen is implementation-dependent. ecmascript 5 clarifies that 10 (decimal) should be used, but not all browsers support this yet. for this reason, al...
Bitwise AND (&) - JavaScript
ion for which the corresponding bits of both operands are 1s. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a & b description the operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones). numbers with more than 32 bits get their most significant bits discarded. for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to firs...
Bitwise NOT (~) - JavaScript
the bitwise not operator (~) inverts the bits of its operand. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax ~a description the operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones). numbers with more than 32 bits get their most significant bits discarded. for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to firs...
Bitwise OR (|) - JavaScript
ich the corresponding bits of either or both operands are 1s. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a | b description the operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones). numbers with more than 32 bits get their most significant bits discarded. for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to firs...
Bitwise XOR (^) - JavaScript
he corresponding bits of either but not both operands are 1s. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax a ^ b description the operands are converted to 32-bit integers and expressed by a series of bits (zeroes and ones). numbers with more than 32 bits get their most significant bits discarded. for example, the following integer with more than 32 bits will be converted to a 32 bit integer: before: 11100110111110100000000000000110000000000001 after: 10100000000000000110000000000001 each bit in the first operand is paired with the corresponding bit in the second operand: first bit to firs...
Division (/) - JavaScript
ght operand is the divisor. the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax operator: x / y examples basic division 1 / 2 // 0.5 math.floor(3 / 2) // 1 1.0 / 2.0 // 0.5 division by zero 2.0 / 0 // infinity 2.0 / 0.0 // infinity, because 0.0 === 0 2.0 / -0.0 // -infinity specifications specification ecmascript (ecma-262)the definition of 'division operator' in that specification. ...
Object initializer - JavaScript
the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
Expressions and operators - JavaScript
omparison is true. == equality operator. != inequality operator. === identity operator. !== nonidentity operator. bitwise shift operators operations to shift all bits of the operand. << bitwise left shift operator. >> bitwise right shift operator. >>> bitwise unsigned right shift operator. binary bitwise operators bitwise operators treat their operands as a set of 32 bits (zeros and ones) and return standard javascript numerical values. & bitwise and. | bitwise or. ^ bitwise xor. binary logical operators logical operators are typically used with boolean (logical) values, and when they are, they return a boolean value. && logical and. || logical or. conditional (ternary) operator (condition ? iftrue : iffalse) the conditional operator returns one...
block - JavaScript
the block is delimited by a pair of braces ("curly brackets") and may optionally be labelled: the source for this interactive example is stored in a github repository. if you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. syntax block statement { statementlist } labelled block statement labelidentifier: { statementlist } statementlist statements grouped within the block statement. labelidentifier an optional label for visual identification or as a target for break. ...
export - JavaScript
statement. bindings that are exported can still be modified locally; when imported, although they can only be read by the importing module the value updates whenever it is updated by the exporting module. exported modules are in strict mode whether you declare them as such or not. the export statement cannot be used in embedded scripts. ...
Statements and declarations - JavaScript
ations consist of statements with an appropriate syntax. a single statement may span multiple lines. multiple statements may occur on a single line if each statement is separated by a semicolon. this isn't a keyword, but a group of keywords. statements and declarations by category for an alphabetical listing see the sidebar on the left. control flow block a block statement is used to group zero or more statements. the block is delimited by a pair of curly brackets. break terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement. continue terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. empty an e...
MathML attribute reference - MathML
izemultiplier <mstyle> specifies the multiplier to be used to adjust font size due to changes in scriptlevel. selection <maction> the child element which is addressed by the action. separator <mo> there is no visual effect for this attribute, but it specifies whether the operator is a separator (such as commas). separators <mfenced> a sequence of zero or more characters to be used for different separators. unimplemented shift <msgroup> unimplemented side <mtable> specifies the position where <mlabeledtr> label elements should be placed. unimplemented src <mglyph> the location of the image resource. unimplemented stackalign <mstack> stretchy <mo> specifies whether the ...
<merror> - MathML
Web › MathML › Element › merror
g to do with <merror>. attributes class, id, style provided for use with stylesheets. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. examples <math> <merror> <mrow> <mtext> division by zero: </mtext> <mfrac> <mn> 1 </mn> <mn> 0 </mn> </mfrac> </mrow> </merror> </math> specifications specification status comment mathml 3.0the definition of 'merror' in that specification. recommendation current specification mathml 2.0the definition of 'merror' in that specification. recommendation initial specification ...
<mfenced> - MathML
y white space is trimmed. href used to set a hyperlink to a specified uri. mathbackground the background color. you can use #rgb, #rrggbb and html color names. mathcolor the text color and also the fraction line color. you can use #rgb, #rrggbb and html color names. open a string for the opening delimiter. the default value is "(" and any white space is trimmed. separators a sequence of zero or more characters to be used for different separators, optionally divided by white space, which is ignored. the default value is ",". by specifying more than one character, it is possible to set different separators for each argument in the expression. if there are too many separators, all excess is ignored. if there are too few separators in the expression, the last specified separator is repea...
Web audio codec guide - Web media technologies
hz at much higher bit rates—usually 64 kbps. if you have plenty of network bandwidth to work with, and are reasonably certain your users will as well, g.722 is the better choice. to maximize the storage and network efficiency in a constrained environment, choose amr. example: audio clips for professional mixing when compressing audio that will be getting mixed or remixed, you typically want zero or close to zero loss of fidelity, which suggests a lossless codec may be in order. however, because lossless encoding naturally has a much lower compression level than lossy encoding, you may find that if your source audio is large enough, you might have to choose a lossy encoder anyway, especially in a web environment in which you can't control the download rate of the media. assuming that los...
Web video codec guide - Web media technologies
r. the biggest drawback of all, however, is that it is not supported by safari, leaving theora unavailable not only on macos but on all those millions and millions of iphones and ipads. the theora cookbook offers additional details about theora as well as the ogg container format it is used within. supported bit rates up to 2 gbps supported frame rates arbitrary; any non-zero value is supported. the frame rate is specified as a 32-bit numerator and a 32-bit denominator, to allow for non-integer frame rates. compression lossy dct-based algorithm supported frame sizes any combination of width and height up to 1,048,560 x 1,048,560 pixels supported color modes y'cbcr with 4:2:0, 4:2:2, and 4:4:4 chroma subsampling at 8 bits per compone...
Using images in HTML - Web media technologies
Web › Media › images
me of the html elements and css properties that are used to control how images are displayed on the web. html <img> the html <img> element is used to embed an image in a webpage. it supports a wide range of attributes that control how the image behaves and allows you to add important information like alt text for people who don't see the image. <picture> the html <picture> element contains zero or more <source> elements and one <img> element which provides versions of an image for different display/device scenarios. the browser considers each child <source> element and chooses the best match among them. css object-fit the object-fit css property sets how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container. object-position the ob...
bias - SVG: Scalable Vector Graphics
Web › SVG › Attribute › bias
olvematrix> element to the input image to yield a number and applied the divisor attribute, the bias attribute is added to each component. this allows representation of values that would otherwise be clamped to 0 or 1. usage notes value <number> default value 0 animatable yes one application of bias is when it is desirable to have 0.5 gray value be the zero response of the filter. specifications specification status comment filter effects module level 1the definition of 'bias' in that specification. working draft no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'bias' in that specification. recommendation initial definition ...
filterRes - SVG: Scalable Vector Graphics
the filterres attribute indicates the width and height of the intermediate images in pixels of a filter primitive. take care when assigning a non-default value to this attribute. too small of a value may result in unwanted pixelation in the result. too large of a value may result in slow processing and large memory usage. note that negative values or zero values disable the rendering of the element which referenced the filter. only one element is using this attribute: <filter> usage notes value <number-optional-number> default value none animatable yes <number-optional-number> this value takes one or two values, the first one outlining the resolution in horizontal direction, the second one in vertical direction. if only one value is speci...
font-size-adjust - SVG: Scalable Vector Graphics
at its lowercase letters (as determined by the x-height of the font) are the specified number times the font-size. the number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. this means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust. 0 yields text of zero height (hidden text). specifications specification status comment css fonts module level 3the definition of 'font-size-adjust' in that specification. candidate recommendation no change scalable vector graphics (svg) 1.1 (second edition)the definition of 'font-size-adjust' in that specification. recommendation initial definition ...
font-variant - SVG: Scalable Vector Graphics
specifications specification status comment css fonts module level 4the definition of 'font-variant' in that specification. working draft no c...
kerning - SVG: Scalable Vector Graphics
Web › SVG › Attribute › kerning
note: as a presentation attribute kerning can be used as a css property. in css the property is called font-kerning, though. ...
markerHeight - SVG: Scalable Vector Graphics
percentage> | <number> default value 3 animatable yes <length-percentage> this value defines either an absolute or a relative height of the marker. relative values refer to the height specified via the viewbox and preserveaspectratio attributes. <number> this value defines the height of the marker in the units defined by the markerunits attribute. a value of zero disables rendering of the element and negative values are an error. specifications specification status comment scalable vector graphics (svg) 2the definition of 'markerheight' in that specification. candidate recommendation allowed percentage and number values. scalable vector graphics (svg) 1.1 (second edition)the definition of 'markerheight' in that...
markerWidth - SVG: Scalable Vector Graphics
th-percentage> | <number> default value 3 animatable yes <length-percentage> this value defines either an absolute or a relative width of the marker. relative values refer to the width specified via the viewbox and preserveaspectratio attributes. <number> this value defines the width of the marker in the units defined by the markerunits attribute. a value of zero disables rendering of the element and negative values are an error. specifications specification status comment scalable vector graphics (svg) 2the definition of 'markerwidth' in that specification. candidate recommendation allowed percentage and number values. scalable vector graphics (svg) 1.1 (second edition)the definition of 'markerwidth' in that s...
order - SVG: Scalable Vector Graphics
Web › SVG › Attribute › order
<rect x="0" y="0" width="200" height="200" style="filter:url(#emboss2); transform: translatex(220px);" /> </svg> usage notes value <number-optional-number> default value 3 animatable yes <number-optional-number> this value indicates the number of cells in each dimension for the kernel matrix. the values provided must be <integer>s greater than zero. values that are not integers will be truncated, i.e. rounded to the closest integer value towards zero. the first number, indicates the number of columns in the matrix. the second number, indicates the number of rows in the matrix. if no second number is not provided, it defaults to the first number. it is recommended that only small values (e.g., 3) be used; higher values may result in very h...
panose-1 - SVG: Scalable Vector Graphics
software that determines the closest possible font match given a set of typefaces. only one element is using this attribute: <font-face> usage notes value <integer>{10} default value 0 0 0 0 0 0 0 0 0 0 animatable no <integer>{10} this value specifies a panose-1 number and consists of ten decimal integers, separated by whitespace. the initial value zero for each panose digit means "any", i.e. all fonts will match the panose number if this value is used. specifications specification status comment scalable vector graphics (svg) 1.1 (second edition)the definition of 'panose-1' in that specification. recommendation initial definition ...
radius - SVG: Scalable Vector Graphics
Web › SVG › Attribute › radius
tribute represents the radius (or radii) for the operation on a given <femorphology> filter primitive. if two numbers are provided, the first number represents the x-radius and the second one the y-radius. if one number is provided, then that value is used for both x and y. the values are in the coordinate system established by the primitiveunits attribute on the <filter> element. a negative or zero value disables the effect of the given filter primitive (i.e., the result is the filter input image). usage notes value <number-optional-number> default value 0 animatable yes specifications specification status comment filter effects module level 1the definition of 'radius' in that specification. working draft no cha...
rx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › rx
/> <ellipse cx="150" cy="50" rx="25" ry="25" /> <ellipse cx="250" cy="50" rx="50" ry="25" /> <rect x="20" y="120" width="60" height="60" rx="0" ry="15"/> <rect x="120" y="120" width="60" height="60" rx="15" ry="15"/> <rect x="220" y="120" width="60" height="60" rx="150" ry="15"/> </svg> ellipse for <ellipse>, rx defines the x-radius of the shape. with a value lower or equal to zero the ellipse won't be drawn at all. value <length> | <percentage> | auto default value auto animatable yes note: starting with svg2, rx is a geometry property meaning this attribute can also be used as a css property for ellipses. rect for <rect>, rx defines the x-axis radius of the ellipse used to round off the corners of the rectangle. the way the v...
ry - SVG: Scalable Vector Graphics
Web › SVG › Attribute › ry
/> <ellipse cx="150" cy="50" ry="25" rx="25" /> <ellipse cx="250" cy="50" ry="50" rx="25" /> <rect x="20" y="120" width="60" height="60" ry="0" rx="15"/> <rect x="120" y="120" width="60" height="60" ry="15" rx="15"/> <rect x="220" y="120" width="60" height="60" ry="150" rx="15"/> </svg> ellipse for <ellipse>, ry defines the y-radius of the shape. with a value lower or equal to zero the ellipse won't be drawn at all. value <length> | <percentage> | auto default value auto animatable yes note: starting with svg2, ry is a geometry property meaning this attribute can also be used as a css property for ellipses. rect for <rect>, ry defines the y-axis radius of the ellipse used to round off the corners of the rectangle. the way the v...
stdDeviation - SVG: Scalable Vector Graphics
<number-optional-number> default value 0 animatable yes <number-optional-number> if two numbers are provided, the first number represents a standard deviation value along the x-axis. the second value represents a standard deviation along the y-axis. if one number is provided, then that value is used for both x and y. a negative value is forbidden. a value of zero disables the effect of the given filter primitive (i.e., the result is the filter input image). if stddeviation is 0 in only one of x or y, then the effect is that the blur is only applied in the direction that has a non-zero value. specifications specification status comment filter effects module level 1the definition of 'stddeviation' in that specification. wor...
targetX - SVG: Scalable Vector Graphics
Web › SVG › Attribute › targetX
the value must be such that: 0 <= targetx < orderx. only one element is using this attribute: <feconvolvematrix> usage notes value <integer> default value floor(orderx / 2) animatable yes <integer> this value indicates the positioning in horizontal direction of the convolution matrix relative to a given target pixel in the input image. ...
targetY - SVG: Scalable Vector Graphics
Web › SVG › Attribute › targetY
the value must be such that: 0 <= targety < ordery. only one element is using this attribute: <feconvolvematrix> usage notes value <integer> default value floor(ordery / 2) animatable yes <integer> this value indicates the positioning in vertical direction of the convolution matrix relative to a given target pixel in the input image. ...
<circle> - SVG: Scalable Vector Graphics
Web › SVG › Element › circle
="http://www.w3.org/2000/svg"> <circle cx="50" cy="50" r="50"/> </svg> attributes cx the x-axis coordinate of the center of the circle. value type: <length>|<percentage> ; default value: 0; animatable: yes cy the y-axis coordinate of the center of the circle. value type: <length>|<percentage> ; default value: 0; animatable: yes r the radius of the circle. a value lower or equal to zero disables rendering of the circle. value type: <length> ; default value: 0; animatable: yes pathlength the total length for the circle's circumference, in user units. value type: <number> ; default value: none; animatable: yes note: starting with svg2, cx, cy, and r are geometry properties, meaning those attributes can also be used as css properties for that element. global attributes ...
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
implemented (bug 1239142) auto-start-reverse value for <marker>'s orient attribute implemented (bug 879659) svgpaint removed implementation status unknown fill and stroke taking multiple paints implementation status unknown z-index not implemented (bug 360148 child(<integer>) paint value implementation status unknown display of zero-length subpaths depends on stroke-linecap attribute implementation status unknown markers on all shapes implementation status unknown <marker> element display defined in ua style sheet implementation status unknown only single paints for fills and strokes implementation status unknown color change notes color managed images ...
Gradients in SVG - SVG: Scalable Vector Graphics
med gradientunits, which describes the unit system you're going to use when you describe the size or orientation of the gradient. there are two possible values to use here: userspaceonuse or objectboundingbox. objectboundingbox is the default, so that's what has been shown so far. it essentially scales the gradient to the size of your object, so you only have to specify coordinates in values from zero to one, and they're scaled to the size of your object automatically for you. userspaceonuse essentially takes in absolute units. so you have to know where your object is, and place the gradient at the same place. the radialgradient above would be rewritten: <radialgradient id="gradient" cx="60" cy="60" r="50" fx="35" fy="35" gradientunits="userspaceonuse"> you can also then apply another tran...
Transport Layer Security - Web security
tls 1.3 changes much of the protocol fundamentals, but preserves almost all of the basic capabilities as previous versions of tls. for the web, tls 1.3 can be enabled without affecting compatibility with some rare exceptions (see below). the major changes in tls 1.3 are: the tls 1.3 handshake completes in one round trip in most cases, reducing handshake latency. a server can enable a 0-rtt (zero round trip time) handshake. clients that reconnect to the server can send requests immediately, eliminating the latency of the tls handshake entirely. though the performance gains from 0-rtt can be significant, they come with some risk of replay attack, so some care is needed before enabling this feature. tls 1.3 supports forward-secure modes only, unless the connection is resumed or it uses a p...
boolean - XPath
ons, xpath functions, xpath axes the boolean function evaluates an expression and returns true or false. syntax boolean( expression ) arguments expression the expression to be evaluated. the expression can refer to numbers and node-sets as well as booleans. returns boolean true or false after evaluating expression. notes a number evaluates to false if it is positive or negative zero or nan. otherwise, it evaluates true. a node-set evaluates to true if it is non-empty. a string evaluates to false if it an empty string. otherwise, it evaluates to true. an object of a type other than the four basic types is converted to a boolean in a way that is dependent on that type. defined xpath 1.0 4.3 gecko support supported. ...
position - XPath
the first node has a position of 1. ...
string - XPath
e string function converts the given argument to a string. syntax string( [object] ) arguments object(optional) the object to convert to a string. if omitted, the context node is used. returns a string notes if the object is a node-set, the string value of the first node in the set is returned. a number is converted as follows: nan is converted to the string nan. positive zero is converted to the string 0. negative zero is converted to the string 0. positive infinity is converted to the string infinity. negative infinity is converted to the string -infinity. decimal numbers between -1 and 1 are converted to a string with a single leading 0 before the decimal point. boolean true is converted to the string true. boolean false is converted to the string ...
substring - XPath
a given string. syntax substring(string ,start [,length] ) arguments string the string to evaluate. start the position withinstring the substring begins length(optional) the length of the substring. if omitted, the returned string will contain every character from thestart position to the end ofstring. returns a string. notes as in other xpath functions, the position is not zero-based. the first character in the string has a position of 1, not 0. defined xpath 1.0 4.2 gecko support supported. ...