JavaScript for WordPress Forums Vanilla JavaScript vanillapress 1.6.17 on firefox Reply To: vanillapress 1.6.17 on firefox

#27267
Alexandra
Participant

it’s in chapter 1.6.17 Load Content from Local Store , in the model

there is this function

/**
 * Checks if local store already exists
 *
 * @return {Boolean} Boolean value for if local store already exists
 */
model.checkLocalStore = function() {

  var store = model.getLocalStore();

  if ( null === store ) {
    return false;
  } else {
    return true;
  }

}

and then it’s used in the init

model.init = function() {

  if( false === model.checkLocalStore() ) {
      model.updateLocalStore( data );
  }
}

But as this function is not used in other places i found that doing it like this

model.init = function() {

  if( false === model.checkLocalStore() ) {
    model.updateLocalStore( data );
  }

}

much more simpler

For the preventDefault on firefox, can you show me how the function would be, and how to make it work on all browser
i am trying things but it doesn’t work

I have tried return false;
searching on google http://stackoverflow.com/questions/1367195/preventdefault-wont-work-on-firefox

but it doesn’t work

this is the actual function

/**
 * Updates local storage for post or page
 *
 */
editor.updateContent = function() {

  event.preventDefault();

  model.updateContent( editor.currentContent );

};