mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 01:50:07 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
cd20c5ab3e
commit
e938bbc5aa
@ -2224,20 +2224,10 @@ Object.assign(
|
||||
return this.dom?.querySelector('.toolbar') },
|
||||
set toolbar(val){},
|
||||
|
||||
// XXX these are generic...
|
||||
encode: function(text){
|
||||
var span = document.createElement('span')
|
||||
span.innerText = text
|
||||
return span.innerHTML },
|
||||
decode: function(text){
|
||||
var span = document.createElement('span')
|
||||
span.innerHTML = text
|
||||
return span.innerText },
|
||||
|
||||
get code(){
|
||||
return this.hasAttribute('value') ?
|
||||
this.getAttribute('value')
|
||||
: this.decode(this.innerHTML) },
|
||||
: HTMLElement.decode(this.innerHTML) },
|
||||
set code(value){
|
||||
if(value == null){
|
||||
return }
|
||||
@ -2245,7 +2235,7 @@ Object.assign(
|
||||
if(this.hasAttribute('value')){
|
||||
this.setAttribute('value', value)
|
||||
} else {
|
||||
this.innerHTML = this.encode(value) } },
|
||||
this.innerHTML = HTMLElement.encode(value) } },
|
||||
|
||||
// XXX do we need this???
|
||||
// ...rename .code -> .value ???
|
||||
|
||||
@ -22,6 +22,20 @@ Element.prototype.visibleInViewport = function(partial=false){
|
||||
&& right <= innerWidth) }
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
// XXX should these be here???
|
||||
HTMLElement.encode = function(str){
|
||||
var span = document.createElement('span')
|
||||
span.innerText = str
|
||||
return span.innerHTML }
|
||||
HTMLElement.decode = function(str){
|
||||
var span = document.createElement('span')
|
||||
span.innerHTML = str
|
||||
return span.innerText }
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
HTMLTextAreaElement.prototype.updateSize = function(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user