GithubHelp home page GithubHelp logo

CSP blocks a line of code about waves HOT 1 OPEN

habibmousavi avatar habibmousavi commented on August 22, 2024
CSP blocks a line of code

from waves.

Comments (1)

marconue avatar marconue commented on August 22, 2024

You can create a new .js file with the following code, it's a little "hack" that allows you to replace the .setAttribute, more info in the webpage https://csplite.com/csp/test343/

`var setAttribute_ = Element.prototype.setAttribute; // Save source of Elem.setAttribute funct
Element.prototype.setAttribute = function (attr, val) {
if (attr.toLowerCase() !== 'style') {
setAttribute_.apply(this, [attr, val]); // Call the saved native Elem.setAttribute funct
}
else { // 'color:red; background-color:#ddd' -> el.style.color='red'; el.style.backgroundColor='#ddd';
var arr = val.split(';').map((el, index) => el.trim());
for (var i = 0, tmp; i < arr.length; ++i) {
if (! /:/.test(arr[i])) continue; // Empty or wrong
tmp = arr[i].split(':').map((el, index) => el.trim());
this.style[camelize(tmp[0])] = tmp[1];
//console.log(camelize(tmp[0]) + ' = '+ tmp[1]);
}
}
}

function camelize(str) {
return str
.split('-') // Parse 'my-long-word' to ['my', 'long', 'word']
.map(
// Coverts all elements to uppercase except first: ['my', 'long', 'word'] -> ['my', 'Long', 'Word']
(word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1)
)
.join(''); // Join ['my', 'Long', 'Word'] to 'myLongWord'
}`

from waves.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.