Skip to content

Instantly share code, notes, and snippets.

@arantius
Created January 24, 2013 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arantius/4622821 to your computer and use it in GitHub Desktop.
Save arantius/4622821 to your computer and use it in GitHub Desktop.
Test case for Greasemonkey issue #1571
// ==UserScript==
// @name dataset test
// @version 1
// @include *
// ==/UserScript==
var el_work = document.createElement('div');
el_work.id = 'el_work';
el_work.setAttribute('data-test2', 'test');
document.head.appendChild(el_work);
var el_fail = document.createElement('div');
el_fail.id = 'el_fail';
el_fail.dataset.test1 = 'test';
document.head.appendChild(el_fail);
setTimeout(function() {
dump('el_work: ' + document.getElementById('el_work').dataset.test2 + '\n');
dump('el_fail: ' + document.getElementById('el_fail').dataset.test1 + '\n');
dump(document.head.innerHTML + '\n');
}, 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment