Git Product home page Git Product logo

Comments (3)

JohnCotterSSA avatar JohnCotterSSA commented on June 25, 2024

Thanks for looking into the code and making a recommendation.

This function already is a loop, and .id performs faster than jquery .attr()

from andi.

ollie-iterators avatar ollie-iterators commented on June 25, 2024

I'm talking about "AndiOverlay.prototype.overlayTableMarkup" in line 1533. The for loop would replace the if statements: "if(role)", "if(id)", "if(headers)", and "if(scope)".

from andi.

ollie-iterators avatar ollie-iterators commented on June 25, 2024

Difference in the code:

Original Code ""

scope = $(this).attr("scope");
headers = $(this).attr("headers");
id = this.id;
role = $(this).attr("role");

markupOverlay = $(this).prop("tagName").toLowerCase();

if(role)
markupOverlay += " role=" + role;
if(id)
markupOverlay += " id=" + id;
if(headers)
markupOverlay += " headers=" + headers;
if(scope)
markupOverlay += " scope=" + scope;

New Code

NOTE: markupOverlay would be moved out of the $("#ANDI508-testPage [data-tandi508-colindex]").each(function() area

var attributesToFind = ["scope", "headers", "id", "role"];
for (var a = 0; a < attributesToFind.length; a++) {
var attributeValue = $(this).attr(attributesToFind[a]);
if (attributeValue) {
markupOverlay += attributesToFind[a] + "=" + attributeValue;
}
}

from andi.

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.