javascript - Function name changes (?) -


i working on script , everythink worked fine, until few days ago. have object, created function(), work several methods. access properties inside object, use this keyword , works fine. example:

var seralcore = seralcore || function ()  {     this.initseral();     return this; };  seralcore.prototype = {      page = null;       initseral = function ()      {           alert(this.page);      } } 

full code: http://pastebin.com/81zn9276
jsfiddle example: https://jsfiddle.net/g2ahu6ob/10/

when have event, callback fired , have access property page, used following, because can't use this anymore:

$('.button').click(function () {      seralcore.page = 'some value'; }); 

this worked well, there error saying cannot reach property (or object, in case*) used in exameple above. output undefined.

i decided investigate output if log seralcore. surprisingly, says following: ouput when logging <code>seralcore</code>

as can see, there < @ end of seralcore, doesn't belong there.
normal? , cause of not being able access properties using "full name" (seralcore.page)? if so, there way fix it?

many, many in advance because can't figure out doing wrong.

snippet:

var seralcore = seralcore || function () {          this.initseral();          return this;      };    window.onload = function () {      this.seralcore = new seralcore();  };    seralcore.prototype = {        page: 'page',            initseral: function ()      {          this.registerpage.start();      },            registerpage: {          start: function ()          {              $('.output').text(typeof seralcore.page + ' (should show \'string\' when can read seralcore.page)');          }      }  };
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>  <span class="output"></span>


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -