Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Different behaviour Chrome and Firefox when using prop('selectedIndex',-1) #22

Closed
invasionofsmallcubes opened this issue Aug 14, 2013 · 3 comments

Comments

@invasionofsmallcubes
Copy link

It's the first time I use backbone-support to handle zombie views.
Before introducing it, I did not have the following problem:

    this.$el.append(this.template());

    // this view fills up a select with options taken from a web services
    this.renderChildInto(new App.view.ResourcesView({name: "idActivityDesc", url: "/wfc-services/resources/activities"}), "#divIdActivityDesc");

    // population of the forms elements according to the loaded model
    this.populateSelectElements();
    this.populateTextElements();

    if(this.model.get('completed')) {
        this.$("#active").removeAttr("disabled");
    }

    this.delegateEvents(this.events);
    return this;

With Firefox it's all working fine. If the model is empty the select elements are going to be set up with default elements. In my case is selectedIndex to -1.

Going in debug inside the view everything seems fine. I have the problem when the view is going to be happened to the parent via the method renderChildInto. The dom is fine, but without the changes derived from the populateSelectElements() if the model is empty. If it's not empty I have no problem and the view is working fine.

I'm really puzzled about it because before the return this; statement, even in Chrome/Chromium I see the selectedIndex to -1. But in the final rendered view on the browser I see the select having selectedIndex to 0.

In the composite_view.js the called code is:

  renderChild: function(view) {
    view.render();
    this.children.push(view);
    view.parent = this;
  },

  renderChildInto: function(view, container) {
    this.renderChild(view);
    this.$(container).html(view.el);
  },
@ecbypi
Copy link
Contributor

ecbypi commented Feb 16, 2015

@invasionofsmallcubes Are you still experiencing this problem? Were you able to find a solution? If not, could you provide a gist or sample code that reproduces the problem?

@invasionofsmallcubes
Copy link
Author

@ecbypi I honestly cannot tell you, it has been ages. I'm not using backbone anymore.

@ecbypi
Copy link
Contributor

ecbypi commented Mar 17, 2015

OK. Thanks for following up.

@ecbypi ecbypi closed this as completed Mar 17, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants