cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-10-30 03:51:33 +03:00
parent cd20c5ab3e
commit e938bbc5aa
2 changed files with 16 additions and 12 deletions

View File

@ -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 ???

View File

@ -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(){