A DOM event.
true
if Control, Alt or Meta were held when the event was
created. Otherwise, false
.
Makes a class string for a node in wed's data tree. The string is meant to be used for the corresponding node in wed's GUI tree.
The original element name.
The namespaces that are known. This is used to convert element name prefixes to namespace URIs.
The class string.
Convert a code sequence created with stringToCodeSequence to a string.
This is meant to be used by wed's internal code.
The sequence to decode.
The decoded string.
Convert a "pattern object" to a string that can be shown to the user. This
function is meant to be used for "complex" name patterns that we may get from
salve. Note that a "pattern object" is the result of calling toObject()
on the pattern. The goal of this function is to convert the pattern object to
a string that would be interpretable by the end user.
An explanation about how this handles namespaces and wildcard patterns is in
order. In a Relax NG schema the name pattern *
in the compact notation is
equivalent to <anyName/>
in the expanded notation. And foo:*
is
equivalent to <nsName ns="uri_of_foo">
where uri_of_foo
is the URI
that has been associated with foo
in the compact schema. It would be nice
if the function here could reuse this notation, but we cannot. Consider the
case where an Relax NG schema in the compact notation wants to declare a name
pattern which means "any name in the default namespace". In XML we express a
name in the default namespace currently in effect by simply not prefixing it
with a namespace name: whereas foo:bar
is the bar
element in the
foo
namespace, bar
is the bar
element in the default
namespace. The pattern "any element in namespace foo" is represented with
foo:*
, however we cannot use *
to mean "any element in the default
namespace", because *
means "any name in any namespace whatsoever". The
compact notation forces the author of the schema to use a prefix for the
default namespace. And because of this, *
means unambiguously "any
element in any namespace".
So the *
in the Relax NG schema becomes *:*
here. "Any element in the
default namespace" is represented by *
. Thus foo:*
and *
can
stand in the same relation to one another as foo:bar
and bar
.
The "pattern object" to convert.
The resolver to use to convert URIs to prefixes.
The string representing the pattern.
Transforms an attribute name from wed's data tree to the original attribute name before the data was transformed for use with wed. This reverses the transformation done with encodeAttrName.
The encoded name.
A structure containing the decoded name the optional qualifier.
Decode the diff produced with encodeDiff.
This is meant to be used by wed's internal code.
The name, after encoding.
The diff.
The decoded attribute name.
Calculates the distance on the basis of two deltas. This would typically be called with the difference of X coordinates and the difference of Y coordinates.
The first delta.
The second delta.
The distance.
Measures the distance of a point from a rectangle. If the point is in the rectangle or touches it, the distance is 0. In the nomenclature below, left and right are on the X axis and top and bottom on the Y axis.
The x coordinate of the point.
The y coordinate of the point.
The left coordinate of the rectangle.
The top coordinate of the rectangle.
The right coordinate of the rectangle.
The bottom coordinate of the rectangle.
The distance.
Measures the absolute horizontal and vertical distances of a point from a rectangle. If the point is in the rectangle or touches it, the distance is
The x coordinate of the point.
The y coordinate of the point.
The left coordinate of the rectangle.
The top coordinate of the rectangle.
The right coordinate of the rectangle.
The bottom coordinate of the rectangle.
The distance.
Transforms an attribute name from its unencoded form in the original XML data (before transformation for use with wed) to its encoded name.
The first thing this algorithm does is compute a difference between the
original XML name and how HTML will record it. The issue here is that XML
allows more characters in a name than what HTML allows and doing
setAttribute(name, value)
will silently convert name
to something
HTML likes. The issue most frequently encountered is that uppercase letters
are encoded as lowercase. This is especially vexing seeing as XML allows the
attribute names x
and X
to exist as different attributes, whereas
HTML does not. For HTML x
and X
are the same attribute. This function
records any differences between the original name and the way HTML records it
with a diff string that is appended to the final name after a dash. If
nothing appears after the final dash, then the HTML name and the XML name are
the same.
A sequence of three dashes or more is converted by adding another dash. (So sequences of single dash, or a pair of dashes remain unchanged. But all sequences of 3 dashes or more gets an additional dash.)
A colon (:
) is converted to three dashes ---
.
After transformation above the name is prepended with data-wed-
and it is
appended with the diff described above.
Examples:
foo:bar
becomes data-wed-foo---bar-
. Note how the diff is
empty, because foo:bar
can be represented as-is in HTML.
MOO:aBc---def
becomes data-wed-moo---abc----def-u3g2u1
. Note the
diff suffix, which allows restoring the orignal case.
When qualifier
is used, the qualifier is added just after data-wed-
and is prepended and appended with a dash. So foo:bar
with the qualifier
ns
would become data-wed--ns-foo---bar-
. The addition of a dash in
front of the qualifier makes it impossible to confuse an encoding that has a
qualifier from one that does not, as XML attribute names are not allowed to
start with a dash.
The unencoded name (i.e. the attribute name as it is in XML).
An optional qualifier.
The encoded name.
Encode the difference between an original string, and a modified string. This is a specialized function designed to handle the difference between the name we want to set for an attribute, and the name that HTML actually records.
This function records the difference as a series of steps to recover the original string:
g[number]
means take [number]
characters from the modified string
as they are.
m[number]
means remove [number]
characters from the modified
string.
p[codes]
means add the codes [codes]
to the modified string.
u[number]
means convert [number]
characters from the modified
string to uppercase.
This is meant to be used by wed's internal code.
The original.
The modified string.
The difference, encoded as a string.
Escape character in CSS class that could cause trouble in CSS selectors. This is not a general solution. It supports enough for the needs of wed.
The class
The escaped class.
This is required to work around a problem when extending built-in classes
like Error
. Some of the constructors for these classes return a value
from the constructor, which is then picked up by the constructors generated
by TypeScript (same with ES6 code transpiled through Babel), and this messes
up the inheritance chain.
Gets all the attributes of the node that were "original" attributes in the XML document being edited, by opposition to those attributes that exist only for HTML rendering.
The node to process.
An object whose keys are attribute names and values are attribute values.
Get the original element name of a node created for wed's data tree.
The element whose name we want.
The name.
Determines whether a data-wed-
attribute corresponds to an XML attribute.
Generates a new generic element id. This id is guaranteed to be unique for the current run of wed. The ids generated by this function are meant to be eventually replaced by something more permanent.
An element id.
This function is meant to be used in debugging. It creates a
selenium_log
object on window
which is an array that contains the
series of obj
passed to this function. Remember that ultimately
selenium_log
is going to be serialized by Selenium. So go easy on what
you put in there and be aware that Selenium may have bugs that prevent
serialization of certain objects.
Objects to log.
This function is meant to be used in debugging. Gets a stack trace. This is only as cross-platform as needed for the platforms we support.
Support for IE 9 is missing because it was designed by baboons.
Convert a string to a sequence of char codes. Each char code will be preceded
by the character x
. The char codes are converted to hexadecimal.
This is meant to be used by wed's internal code.
The string to encode.
The encoded string.
Generated using TypeDoc