From c8b7040144cf79ccbf184ccd087efaedbf7ca089 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 28 Aug 2013 14:54:55 -0700 Subject: [PATCH] :racehorse: Find elements by id in spec reporter Previously classes containing the spec/suite id were used which caused major amounts of time finding DOM nodes using class selectors instead of id selectors. This decreases the Editor spec from ~90s to ~30s. --- spec/atom-reporter.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 7a675f98c..f2fb1461a 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -130,7 +130,7 @@ class AtomReporter extends View bundledPackageSpecs = 0 userPackageSpecs = 0 for spec in specs - symbol = $$ -> @li class: "spec-summary pending spec-summary-#{spec.id}" + symbol = $$ -> @li id: "spec-summary-#{spec.id}", class: "spec-summary pending" switch spec.specType when 'core' coreSpecs++ @@ -159,7 +159,7 @@ class AtomReporter extends View @runningSpecCount++ specComplete: (spec) -> - specSummaryElement = $(".spec-summary-#{spec.id}") + specSummaryElement = $("#spec-summary-#{spec.id}") specSummaryElement.removeClass('pending') specSummaryElement.data("description", spec.getFullName()) @@ -185,7 +185,7 @@ class SuiteResultView extends View suite: null initialize: (@suite) -> - @addClass("suite-view-#{@suite.id}") + @attr('id', "suite-view-#{@suite.id}") @description.html @suite.description attach: -> @@ -194,7 +194,7 @@ class SuiteResultView extends View parentSuiteView: -> return unless @suite.parentSuite - if not suiteView = $(".suite-view-#{@suite.parentSuite.id}").view() + if not suiteView = $("#suite-view-#{@suite.parentSuite.id}").view() suiteView = new SuiteResultView(@suite.parentSuite) suiteView.attach() @@ -222,7 +222,7 @@ class SpecResultView extends View @parentSuiteView().append this parentSuiteView: -> - if not suiteView = $(".suite-view-#{@spec.suite.id}").view() + if not suiteView = $("#suite-view-#{@spec.suite.id}").view() suiteView = new SuiteResultView(@spec.suite) suiteView.attach()