Given this following sample code which clones a table row, sets some properties and then appends it to a table:
$("#FundTable").append(
objButton.parents("tr").clone()
.find(".RowTitle").text("Row " + nAddCount).end()
.find(".FundManagerSelect").attr("id", "FundManager" + nAddCount)
.change(function() { ChangeFundRow(); }).end()
.find(".FundNameSelect").attr("id", "FundName" + nAddCount).end()
);
Does anyone have any suggestions as to how this might be formatted to be easier on the eye? Is there any accepted convention for doing this?
It would be useful to have a set of rules that can be followed, and that can be incorporated into a set of standards.
How about:
I find that chaining, when used in moderation, can lead to better readability.
I indent as if it were bracketed:
I would refactor to this. I find more than 3 chained methods uneasy on the eye
Don't chain so much.
Less chaining, but it seems easier to read imo.