Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Add fallback runScript insertion location #144

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,9 @@
function runScript(code) {
var anchor = freeDefine ? define.amd : Benchmark,
script = doc.createElement('script'),
sibling = doc.getElementsByTagName('script')[0],
sibling = doc.getElementsByTagName('script')[0] ||
doc.body.children[doc.body.children.length - 1] || // Last Element Node in <body> OR
doc.body.appendChild(doc.createElement('script')), // Create element to insert next to
parent = sibling.parentNode,
prop = uid + 'runScript',
prefix = '(' + (freeDefine ? 'define.amd.' : 'Benchmark.') + prop + '||function(){})();';
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "benchmark",
"version": "2.1.1",
"version": "2.1.0",
"description": "A benchmarking library that supports high-resolution timers & returns statistically significant results.",
"homepage": "https://benchmarkjs.com/",
"license": "MIT",
Expand All @@ -14,19 +14,19 @@
],
"repository": "bestiejs/benchmark.js",
"scripts": {
"doc": "docdown benchmark.js doc/README.md style=github title=\"<a href=\\\"https://benchmarkjs.com/\\\">Benchmark.js</a> <span>v${npm_package_version}</span>\" toc=categories url=https://github.com/bestiejs/benchmark.js/blob/${npm_package_version}/benchmark.js",
"doc": "docdown benchmark.js doc/README.md toc='categories' url=\"https://github.com/bestiejs/benchmark.js/blob/${npm_package_version}/benchmark.js\" title=\"<a href=\\\"https://benchmarkjs.com/\\\">Benchmark.js</a> <span>v${npm_package_version}</span>\" hash='github'",
"test": "node test/test"
},
"dependencies": {
"lodash": "^4.14.2",
"lodash": "^4.13.1",
"platform": "^1.3.1"
},
"devDependencies": {
"coveralls": "^2.11.12",
"docdown": "~0.7.1",
"coveralls": "^2.11.9",
"docdown": "~0.5.1",
"istanbul": "0.4.4",
"qunit-extras": "^2.1.0",
"qunitjs": "^2.0.1",
"qunit-extras": "^2.0.1",
"qunitjs": "^2.0.0",
"requirejs": "^2.2.0"
},
"files": [
Expand Down