syntax highlighting on WordPress: you can quote me on this

I've totally over-blogged this month, but just as a note to self …

I've noticed that when using a syntax highlighter with WordPress – I'm using Syntax Highlighter Compress – that using single quotes can sometimes cause the highlighting to break down.

In the example below I have identical code written twice. Well, almost identical. In the first, I'm surrounding "data-startTime" with single quotes and in the second I'm using doubles. The first has some highlighting problems where single quotes are.

Oh well, I guess I'll just have to keep an eye on that.

function jAUs_3(this_currentTime,thisAudioTag_stopTime,i){

  if (thisAudioTag_stopTime){
    //if there's a data-stopTime attribute then ...
    if (this_currentTime > thisAudioTag_stopTime){
      //... reset audio to data-startTime when data-stopTime is reached.
      audioTagArray[i].currentTime = audioTagArray[i].getAttribute('data-startTime'); 
      audioTagArray[i].pause();
    }
  }
  else if (audioTagArray[i].ended == true){
    //if there's no data-stopTime, move back to data-startTime when playback has ended.
    audioTagArray[i].currentTime = audioTagArray[i].getAttribute('data-startTime');
    audioTagArray[i].pause();
  }
}
function jAUs_3(this_currentTime,thisAudioTag_stopTime,i){

  if (thisAudioTag_stopTime){
    //if there's a data-stopTime attribute then ...
    if (this_currentTime > thisAudioTag_stopTime){
      //... reset audio to data-startTime when data-stopTime is reached.
      audioTagArray[i].currentTime = audioTagArray[i].getAttribute("data-startTime"); 
      audioTagArray[i].pause();
    }
  }
  else if (audioTagArray[i].ended == true){
    //if there's no data-stopTime, move back to data-startTime when playback has ended.
    audioTagArray[i].currentTime = audioTagArray[i].getAttribute("data-startTime");
    audioTagArray[i].pause();
  }
}
--------------

Related Content:

Leave a Comment

Your email address will not be published. Required fields are marked *

*