File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -15,9 +15,15 @@ A simple and easy JavaScript library for highlighting .NET stack traces
1515[ Stack Trace Formatter - Online pretty print of .NET stack traces] ( https://elmah.io/tools/stack-trace-formatter/ )
1616
1717#### Initialization
18+ Using a string that represents a CSS selector:
1819``` javascript
1920const stack = new netStack (' .stacktrace' );
2021```
22+ Passing an HTMLElement object:
23+ ``` javascript
24+ const stackElement = document .querySelector (' .stacktrace' );
25+ const stack = new netStack (stackElement);
26+ ```
2127
2228#### Default values for classes
2329``` javascript
Original file line number Diff line number Diff line change 2020
2121 function netStack ( element , options ) {
2222 if ( typeof document !== 'undefined' ) {
23- this . element = document . querySelector ( element ) ;
23+ if ( typeof element === 'string' ) {
24+ this . element = document . querySelector ( element ) ;
25+ } else if ( element instanceof HTMLElement ) {
26+ this . element = element ;
27+ } else {
28+ throw new Error ( 'The element parameter must be a selector string or an HTMLElement.' ) ;
29+ }
2430 } else {
2531 throw new Error ( 'netStack requires a DOM environment' ) ;
2632 }
You can’t perform that action at this time.
0 commit comments