WordPress.org

Ready to get started?Download WordPress

Forums

WordPress SEO by Yoast
[resolved] Page Edit JavaScript Errors (15 posts)

  1. tnolte
    Member
    Posted 3 years ago #

    When using this plugin I'm getting JavaScript errors in wp-seo-metabox.js(line 260) on Page Edit. This is breaking just about all of the JavaScript on the page. In Google Chrome I get the following report:

    Uncaught TypeError: Object function each(iterator, context) {
        var index = 0;
        try {
          this._each(function(value) {
            iterator.call(context, value, index++);
          });
        } catch (e) {
          if (e != $break) throw e;
        }
        return this;
      } has no method 'replace'

    In Firefox 3.6 I get:

    keywords[i].replace is not a function
    [Break On This Error] var urlfocuskw = keywords[i].replace(' ','-').toLowerCase();

    In Safari I get:

    TypeError: Result of expression 'keywords[i].replace' [undefined] is not a function.

    I had to make a couple of code changes in order to keep the JavaScript from breaking. Can anyone else confirm there is an error here? I've gone through and disabled all of my other plugins only to still have this issue remain.

    http://wordpress.org/extend/plugins/wordpress-seo/

  2. browndp08
    Member
    Posted 3 years ago #

    I get the same error. It is not letting me upload any media into a post.

  3. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Which version of WP and which version of the plugin are you using?

  4. tnolte
    Member
    Posted 3 years ago #

    WordPress 3.0.5
    WordPress SEO 0.2.3.3

  5. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Update already, both to WordPress 3.1.1 (there's a security hole in your current version) as to WordPress SEO 0.2.5.2 :)

  6. tnolte
    Member
    Posted 3 years ago #

    Yes well it would be nice if it was that simple. Since they have uppdated the TinyMCE in WP 3.1 this is going to break some key features of our install. I do see that there is an update for WP SEO which I will try. Just a comment though is that if this plugin is only intended to work with 3.1 then it should be tagged that way. Maybe it is and I missed that. Does the latest version of WP SEO fix the JavaScript errors?

  7. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Yes it fixes the JavaScript errors (I think).

    If you can't update, you're doing it wrong. The plugin does not required WP 3.1, the security of your blog however, does require that you upgrade.

  8. tnolte
    Member
    Posted 3 years ago #

    I guess I'm not sure what you mean about if I can't update I'm doing it wrong. Not sure if you mean my WordPress install or the plugin install. I can technically update both, that is not the problem, I just can't afford to break the website and risk our users not being able to use our custom built plugins that rely on TinyMCE. I will try updating the plugin tonight though. Thanks for the great plugin and all of the time you've put into it!

  9. tnolte
    Member
    Posted 3 years ago #

    OK, well I updated to the latest version of the plugin in our Dev environment. Still getting the same JavaScript error. The error is occurring on line 200 instead of 260 now, but nevertheless it's still broken. I'm curious if this has something to do with the jQuery that our site uses. I'm using the Google APIs jQuery, matching the same version that comes with WP 3.0.x but I'm also using the Google APIs jQuery UI with some extra components as well. I'll just have to go in again and modify the JS to prevent the issue form breaking all the JS on the Page edit.

  10. tnolte
    Member
    Posted 3 years ago #

    Another possibility for the issues could be related to my use of the More Fields plugin. I wouldn't think this would be a problem but it is another plugin that makes changes to the Page edit page.

  11. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    Hmm are you entering html tags in to the focus keyword field by any chance? I've added a fix to 0.2.5.3, coming later today, that might resolve this but not 100% sure.

    Also re: you're doing it wrong: you should always be able to upgrade your WordPress install. If you're not, I seriously think you're doing something wrong.

  12. tnolte
    Member
    Posted 3 years ago #

    Ok, well I didn't get a chance to upgrade to 0.2.5.3, however I just upgraded to 0.2.5.4 and I'm getting the same error but now on line 66:

    Uncaught TypeError: Object function each(iterator, context) {...
    ...} has no method 'replace'
    wp-seo-metabox.js:66

    On the final note, as far as doing something wrong, then that would seem to be the problem for every plugin developer. When WordPress changes core functionality that a plug relies on and then the plugin is broken how is that the plugin develop did something wrong. I may be able to upgrade without a problem, however I already do know that the TinyMCE Advanced plugins was(maybe still is) broken because of the TinyMCE changes in 3.1.

  13. Joost de Valk
    Member
    Plugin Author

    Posted 3 years ago #

    The next release of the plugin will feature a load of changes to all the JS for the metabox, most of them improving speed and stability, give it a go once it comes out!

  14. tnolte
    Member
    Posted 2 years ago #

    Joost,

    I have again found a javascript bug in wp-seo-metabox.js with the error:

    Uncaught TypeError: Object function each(iterator, context) {
        var index = 0;
        try {
          this._each(function(value) {
            iterator.call(context, value, index++);
          });
        } catch (e) {
          if (e != $break) throw e;
        }
        return this;
      } has no method 'replace'

    I did some debugging in Google Chrome and found that for some reason in the function boldKeywords() when you are iterating over the keywords array it somehow is trying to iterate using an entire 'each' function as the key value. What I had to do was change the for loop to use a standard counter with a limit of the keywords.length.

    Line 179:
    original
    for (var i in keywords) {
    mine
    for (var i=0;i<keywords.length;i++) {
    using my change I no longer get an error and this also doesn't break the rest of the javascript in the page.

  15. Joost de Valk
    Member
    Plugin Author

    Posted 2 years ago #

    Ha, tnolte, you're a bloody hero. That fixed it, coming up in 1.0.1

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic