Add a function to ElementLinearData to count all elements that aren't in internalList

Needed to fix ve.ui.MWReferenceDialog.prototype.onDocumentTransact to work properly
with existing references.

Change-Id: I8ecbf387ac8dff02dc1fab8d41189edd6e9a8974
Merge "Add a function to ElementLinearData to count all elements that aren't in internalList"