traxxx/src/utils/jsdom-url.js

18 lines
830 B
JavaScript

'use strict';
const { JSDOM } = require('jsdom');
const el = new JSDOM(`
<span id="url" style="background-image: url(https://w.wallhaven.cc/full/dg/wallhaven-dg7y23.jpg);">
<span id="urlQuotes" style="background-image: url('https://w.wallhaven.cc/full/dg/wallhaven-dg7y23.jpg');">
<span id="color" style="color: rgb(255, 0, 0);">
<span id="urlSpaces" style="background-image: url( https://w.wallhaven.cc/full/md/wallhaven-mdvmrm.jpg );">
<span id="colorSpaces" style="color: rgb( 255, 0, 0 );">
`).window.document;
console.log(el.querySelector('#url').style.backgroundImage);
console.log(el.querySelector('#urlQuotes').style.backgroundImage);
console.log(el.querySelector('#color').style.color);
console.log(el.querySelector('#urlSpaces').style.backgroundImage);
console.log(el.querySelector('#colorSpaces').style.color);