mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-09 16:35:01 -04:00
Export DOMInterface.
This commit is contained in:
parent
b023eb1fe5
commit
cbd300101d
1 changed files with 37 additions and 34 deletions
|
@ -30,6 +30,41 @@ var Changeset = require('./Changeset');
|
||||||
var hooks = require('./pluginfw/hooks');
|
var hooks = require('./pluginfw/hooks');
|
||||||
var _ = require('./underscore');
|
var _ = require('./underscore');
|
||||||
|
|
||||||
|
var DOMInterface = {
|
||||||
|
isNodeText: function(n)
|
||||||
|
{
|
||||||
|
return (n.nodeType == 3);
|
||||||
|
},
|
||||||
|
nodeTagName: function(n)
|
||||||
|
{
|
||||||
|
return n.tagName;
|
||||||
|
},
|
||||||
|
nodeValue: function(n)
|
||||||
|
{
|
||||||
|
return n.nodeValue;
|
||||||
|
},
|
||||||
|
nodeNumChildren: function(n)
|
||||||
|
{
|
||||||
|
return n.childNodes.length;
|
||||||
|
},
|
||||||
|
nodeChild: function(n, i)
|
||||||
|
{
|
||||||
|
return n.childNodes.item(i);
|
||||||
|
},
|
||||||
|
nodeProp: function(n, p)
|
||||||
|
{
|
||||||
|
return n[p];
|
||||||
|
},
|
||||||
|
nodeAttr: function(n, a)
|
||||||
|
{
|
||||||
|
return n.getAttribute(a);
|
||||||
|
},
|
||||||
|
optNodeInnerHTML: function(n)
|
||||||
|
{
|
||||||
|
return n.innerHTML;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function sanitizeUnicode(s)
|
function sanitizeUnicode(s)
|
||||||
{
|
{
|
||||||
return UNorm.nfc(s).replace(/[\uffff\ufffe\ufeff\ufdd0-\ufdef\ud800-\udfff]/g, '?');
|
return UNorm.nfc(s).replace(/[\uffff\ufffe\ufeff\ufdd0-\ufdef\ud800-\udfff]/g, '?');
|
||||||
|
@ -39,40 +74,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
{
|
{
|
||||||
browser = browser || {};
|
browser = browser || {};
|
||||||
|
|
||||||
var dom = domInterface || {
|
var dom = domInterface || DOMInterface;
|
||||||
isNodeText: function(n)
|
|
||||||
{
|
|
||||||
return (n.nodeType == 3);
|
|
||||||
},
|
|
||||||
nodeTagName: function(n)
|
|
||||||
{
|
|
||||||
return n.tagName;
|
|
||||||
},
|
|
||||||
nodeValue: function(n)
|
|
||||||
{
|
|
||||||
return n.nodeValue;
|
|
||||||
},
|
|
||||||
nodeNumChildren: function(n)
|
|
||||||
{
|
|
||||||
return n.childNodes.length;
|
|
||||||
},
|
|
||||||
nodeChild: function(n, i)
|
|
||||||
{
|
|
||||||
return n.childNodes.item(i);
|
|
||||||
},
|
|
||||||
nodeProp: function(n, p)
|
|
||||||
{
|
|
||||||
return n[p];
|
|
||||||
},
|
|
||||||
nodeAttr: function(n, a)
|
|
||||||
{
|
|
||||||
return n.getAttribute(a);
|
|
||||||
},
|
|
||||||
optNodeInnerHTML: function(n)
|
|
||||||
{
|
|
||||||
return n.innerHTML;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var _blockElems = {
|
var _blockElems = {
|
||||||
"div": 1,
|
"div": 1,
|
||||||
|
@ -703,5 +705,6 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
|
||||||
return cc;
|
return cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.DOMInterface = DOMInterface;
|
||||||
exports.sanitizeUnicode = sanitizeUnicode;
|
exports.sanitizeUnicode = sanitizeUnicode;
|
||||||
exports.makeContentCollector = makeContentCollector;
|
exports.makeContentCollector = makeContentCollector;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue