Skip to content

Commit d61449e

Browse files
committed
fix selector
1 parent ee54e6e commit d61449e

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ A simple and easy JavaScript library for highlighting .NET stack traces
1616

1717
#### Initialization
1818
```javascript
19-
const stack = new netStack(document.querySelector('.stacktrace'));
19+
const stack = new netStack('.stacktrace');
2020
```
2121

2222
#### Default values for classes
2323
```javascript
24-
const stack = new netStack(document.querySelector('.stacktrace'), {
24+
const stack = new netStack('.stacktrace', {
2525
frame: 'st-frame',
2626
type: 'st-type',
2727
method: 'st-method',
@@ -38,7 +38,7 @@ const stack = new netStack(document.querySelector('.stacktrace'), {
3838
Default: false.
3939
Pretty prints your stacktrace.
4040
```javascript
41-
const stack = new netStack(document.querySelector('.stacktrace'), {
41+
const stack = new netStack('.stacktrace', {
4242
prettyprint: true
4343
});
4444
```

netstack.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
}(typeof self !== 'undefined' ? self : this, function() {
2020

2121
function netStack(element, options) {
22-
this.element = element;
22+
if (typeof document !== 'undefined') {
23+
this.element = document.querySelector(element);
24+
} else {
25+
throw new Error('netStack requires a DOM environment');
26+
}
2327

2428
// Default values for classes
2529
this.settings = extend({

0 commit comments

Comments
 (0)