File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " simple-tsx" ,
3
- "version" : " 1.2.0 " ,
3
+ "version" : " 1.2.1 " ,
4
4
"description" : " A simple way to write tsx files. No babel required!" ,
5
5
"main" : " dist/index.js" ,
6
6
"type" : " commonjs" ,
Original file line number Diff line number Diff line change 1
1
import { AttributeValueType , AttributesType } from "./types" ;
2
2
3
3
export default class Element {
4
- element : HTMLElement ;
4
+ private privElement ? : HTMLElement ;
5
5
6
6
// This will allow you to use this class for IntrinsicElements. I know this is a hacky way to do things but I don't have anything better.
7
- [ name : string ] : AttributeValueType | HTMLElement ;
7
+ [ name : string ] : AttributeValueType | HTMLElement | undefined ;
8
+
9
+ public get element ( ) : HTMLElement {
10
+ return this . privElement !
11
+ }
8
12
9
13
constructor (
10
14
tagName : string ,
11
15
attributes : AttributesType | null ,
12
16
...children : ( Element | string | number | null | undefined ) [ ]
13
17
) {
14
- this . element = document . createElement ( tagName ) ;
18
+ this . privElement = document . createElement ( tagName ) ;
15
19
const trueAttributes = attributes || { } ;
16
20
Object . entries ( trueAttributes ) . forEach ( ( [ key , value ] ) => {
17
21
if ( key . startsWith ( "on" ) && key . toLowerCase ( ) in window ) {
You can’t perform that action at this time.
0 commit comments